浏览器关闭时 Laravel 过期会话在 Chrome 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22713483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel expire session on browser close not working in Chrome
提问by medowlock
I am using Laravel Framework version 4.1.21 and the "expire_on_close" option does not end the session in Chrome when the browser is closed. The options in my config/session.php file look like this:
我使用的是 Laravel Framework 4.1.21 版,当浏览器关闭时,“expire_on_close”选项不会结束 Chrome 中的会话。我的 config/session.php 文件中的选项如下所示:
'driver' => 'file',
'lifetime' => 120,
'expire_on_close' => true,
Also in the developer toolbar, under Resources > Cookies, the Expires value is set to "Session" for the laravel_session cookie.
同样在开发人员工具栏中,在 Resources > Cookies 下,对于 laravel_session cookie,Expires 值设置为“Session”。
This works fine in Firefox though. Any ideas what am I missing ? Thanks !
不过这在 Firefox 中运行良好。任何想法我错过了什么?谢谢 !
回答by metude
It's becasue of Chrome's feature. When you close Google Chrome, it actually runs on background (as mentioned on comments).
这是因为 Chrome 的功能。当您关闭 Google Chrome 时,它实际上在后台运行(如评论中所述)。
Here's detailed information: https://code.google.com/p/chromium/issues/detail?id=128513
这是详细信息:https: //code.google.com/p/chromium/issues/detail?id=128513