我尝试添加一个函数
public function postLogout() {
//Auth::logout();
return response()->json(['msg' => 'You have signed out']);
}
进入文件
\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php
并使用路线
Route::get('log_out', ['as' => 'auth.log_out', 'uses' => 'Auth\AuthController@postLogout']);
如何从 url http://localhost/myproj/public/log_out 开始自动重定向在那种情况下??? 谢谢
最佳答案
自动是什么意思?您想注销用户并在之后重定向,对吗?您可以同时重定向和闪烁一条消息,这在这种情况下很有意义。
Route::get('log_out', function () {
//Auth::logout();
return redirect('log_in')->with('status', 'You have signed out!');
});
阅读更多 here
关于php - laravel 并从注销中删除重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33449715/