且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP会话超时回调?

更新时间:2023-12-04 18:55:28

除了使用crontab的工作,当检测PHP会话超时,你可以创建一个脚本,将在一些半固定时间间隔(每5分钟说运行最有可能的),将注销/执行清理的人谁没有在最后时刻被激活(或任何你超时值)自动。只需添加一个'lastseen您的用户表。

Instead of detecting when the php session times out, you could create a script that will run at some semi regular interval (every 5 minutes say, using a crontab job most likely) that will log out/perform the clean up for anyone who hasn't been active in the last hour (or whatever your timeout value is) automatically. Just add a 'lastseen' to your user table.