且构网

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

会话已过期完成然后如何跟踪特定用户会话已到期..

更新时间:2023-11-27 23:47:52

会话是按用户划分的。因此,当会话结束时,它是针对特定用户的,但事实是它已经结束,这意味着您无法轻易确定它是谁。您需要在数据库中跟踪登录的用户,以便在会话结束时数据仍然存在,然后找出一种方法来判断哪个会话已结束。另一种方法是存储每个用户上次发出页面请求的时间,在超时期限内未提出请求的人将是其会话过期的。
The session is per user. So when a session ends, it is for a specific user, but the fact that it's ended, means you can't easily tell who it was. You would need to track who was logged in, in your database, so that data still exists when the session ends, then work out a way to tell which session ended. Another way is to store when each user last made a page request, the person who has not made a request in your timeout period, is going to be whose session expired.