简体   繁体   English

如何在关闭浏览器时删除会话?

[英]How to delete session on closing browser?

How do I destroy Magento sessions when a user closes his/her browser in Magento? 当用户在Magento中关闭浏览器时,如何销毁Magento会话?

I tried to close and reopen my browser and I remain logged in. It looks like Magento persists the login status for certain amount of time. 我试图关闭并重新打开浏览器,但仍保持登录状态。Magento看起来会保持登录状态一定时间。 I changed 'cookie lifetime' under configuration, but it does not work. 我在配置下更改了“ Cookie生存期”,但它不起作用。

I could use session_set_cookie_params() in index.php, but I would like to know if I can fix it without touching code directly. 我可以在index.php中使用session_set_cookie_params() ,但是我想知道是否可以在不直接接触代码的情况下进行修复。

Normally a cookie lifetime of "0" means "when the browser exits". 通常,cookie的生存期为“ 0”表示“浏览器退出时”。 I'm not sure if Magento changes the behaviour but it's worth a try. 我不确定Magento是否会更改行为,但是值得尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM