Laravel 5 Auth注销未破坏会话 [英] Laravel 5 Auth Logout not destroying session

查看:68
本文介绍了Laravel 5 Auth注销未破坏会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为新项目使用Laravel5 Auth系统,我可以使用注册和登录功能而不会出现任何问题,但注销未按预期方式工作,但是我重定向到了$redirectAfterLogout中指定的url,但没有销毁会话,因此即使单击注销按钮,我也可以看到仪表板.

I am using Laravel5 Auth system for my new project, I am able to use registration and login functions with out any problem but logout is not working as expected, however I get redirected to url specified at $redirectAfterLogout but it does not destroy session so even after hitting logout button I am able to see dashboard.

laravel是否在Auth系统中存在一些错误,请提出建议,谢谢

Does laravel has some bug in Auth system, please suggest, thanks

推荐答案

您尚未提供任何已使用的代码.但是,以下代码有效:

You have not provided any piece of code that you have used. However, the following code works:

public function getLogout(){
    Auth::logout();
    Session::flush();
    return Redirect::to('/');
}

Session::flush();清除所有现有的会话.

The Session::flush();clears all the existing sessions.

这篇关于Laravel 5 Auth注销未破坏会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆