登录正常,但是退出的时候并没有清掉session,退出后还是处于登录状态。解决方法如下:
路由如下
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
Route::group(['namespace' => 'Admin', 'middleware' => 'auth'], function() {
Route::resource('admin/post', 'PostController');
});
// 登陆
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
// 5.2版本这里的方法需要写成logout,因为在中间件中是这么定义的
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}
// 路由中的方法要跟上述一致
Route::get('auth/logout', 'Auth\\AuthController@logout');
|
AuthController.php中的
?
|
1
2
3
4
|
// 登录成功后跳转地址
protected $redirectTo = 'admin/post';
// 退出后跳转地址
protected $redirectAfterLogout = 'auth/login';
|
参考 http://stackoverflow.com/questions/34479994/laravel-5-2-authlogout-is-not-working
调试过程中在AppserviceProvider的boot方法里添加输出sql也会导致类似的错误,所以在登录调试时,尽量不要这样做
?
|
1
2
3
4
5
6
7
8
9
10
11
|
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// \\DB::listen(function($sql) {
// dump($sql->sql);
// });
}
|
以上这篇解决Laravel5.2 Auth认证退出失效的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持快网idc。
原文链接:https://blog.csdn.net/fationyyk/article/details/51514366
相关文章
猜你喜欢
- ASP.NET自助建站系统中如何实现多语言支持? 2025-06-10
- 64M VPS建站:如何选择最适合的网站建设平台? 2025-06-10
- ASP.NET本地开发时常见的配置错误及解决方法? 2025-06-10
- ASP.NET自助建站系统的数据库备份与恢复操作指南 2025-06-10
- 个人网站服务器域名解析设置指南:从购买到绑定全流程 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-06-04 83
-
2025-05-29 62
-
2025-05-25 37
-
2025-05-29 12
-
2025-05-27 40
热门评论

