Redirect::back() 在 laravel 5.4 中不起作用


if(count($data) == 1)
{
return view('home');
}
else {
// echo"ta-da";
Redirect::back()->with('message','username or password not Match!'); 
}

上面的重定向::back(( 函数在登录时不起作用。如果我正在打印它显示的任何内容

您需要

return重定向

要重定向,您必须使用Laravel内置函数

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

或者你可以使用 route(( 方法的状态 back(( 方法

return redirect()->route('your.route.name')->with('msg_name', 'your message');

在重定向之前使用返回重定向到路由

最新更新