简体   繁体   English

Laravel重定向不起作用

[英]Laravel Redirect does not work

I'll try to redirect with a message in a normal Laravel 5.2 controller but this still doesn't work. 我将尝试在普通的Laravel 5.2控制器中使用消息重定向,但这仍然无法正常工作。 I don't know why, because in a other controller it works. 我不知道为什么,因为在另一个控制器中它可以工作。 This is the controller who's not working: 这是不起作用的控制器: 在此处输入图片说明

And this is the controller who's working: 这是正在工作的控制器: 在此处输入图片说明

Have anyone an idea why this doesn't redirect? 有谁知道为什么不重定向? I haven't any errors or something. 我没有任何错误或什么。 It does simply nothing. 它什么都不做。

Thank you! 谢谢!

Try this: 尝试这个:

return redirect()->back()->with('message', 'Your message');

Or try to use \\Redirect instead of Redirect if you want to use facade. 或者,如果要使用立面,请尝试使用\\Redirect而不是Redirect

Try use global namespace in first case 尝试在第一种情况下使用全局名称空间

return \Redirect::back();

or use helper function 或使用辅助功能

return redirect()->back();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM