如果用户关闭浏览器窗口或导航离开php中的页面,我该如何销毁会话? [英] How can I destroy sessions if user closes the browser window or navigates away from page in php?

查看:120
本文介绍了如果用户关闭浏览器窗口或导航离开php中的页面,我该如何销毁会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些保存的会话。如果用户关闭浏览器窗口或单个选项卡或导航离开页面,我想销毁所有会话。有什么方法可以做到吗?

I have some sessions that are saved. I want to destroy all the sessions if the user closes the browser window or a single tab or navigates away from the page. Is there any way I can do this?

推荐答案

现在所有现代标签式浏览器都很复杂。因此,您只能依赖会话超时。不过没什么大不了的。你确定你真的需要这个吗?这会让用户感到痛苦。

It's quite complicated nowadays with all the modern tabbed browsers. So, you can rely only on the session timeout. Not a big deal though. Are you sure you really need this? That would make pain in the bottom for the users.

这篇关于如果用户关闭浏览器窗口或导航离开php中的页面,我该如何销毁会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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