如何使用 Zend Framework 查看已登录的在线用户 [英] How to check logged in online users using Zend Framework

查看:22
本文介绍了如何使用 Zend Framework 查看已登录的在线用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用 Zend Framework 获取当前在线或在网站上进行活动会话的用户数量.

I want to know how to get the number of users currently online or having active sessions on a website using Zend Framework.

我尝试了读取会话保存路径的常用方法,但使用 Zend 无法正常工作.任何人都可以向我推荐一个好方法来随时了解服务器上有多少活动会话.

I tried the usual way of reading Session save path, but its not working using Zend. Can anyone here suggest me a good method to know how many active sessions are on the server at any moment of time.

推荐答案

你不能使用会话来做到这一点,你必须将在线用户存储在一个数据库中并显示所有活跃的用户.on log out delete/从数据库更新记录.

You can't use sessions to do this, you would have to store the online users in a DB and display all who are active.on log out delete/update records from db.

或者在您的用户表中放置一个标志,并在每次用户登录/注销时将标志更新为 y/n.

or put a flag in ur users table and update flag as y/n every time a user logged in / log out.

或类似的东西.

如果用户在没有注销的情况下关闭浏览器,那么下次用户尝试登录时.您可以检查该用户以前的活动会话,如果有?向用户提供一个窗口,指出上次注销不正确,并从该用户处获取任何事件以更新时间,或者您可以要求用户输入退出时间(估计)以用于延迟会话,或者如果用户对选择时间不感兴趣,您可以更新注销有登出时间.中伤登录时间间隔.

If user closes browser without logout then when next time user tries to log in. u can check previous active sessions for that user, if there? give a window to user that last logout was not correct and take any event from that user to update time or u can ask user to enter log out time (estimated) for late session or if users are not interested to select time u can update logout with a logout time . make a slandered interval of login duration.

这样想......

这篇关于如何使用 Zend Framework 查看已登录的在线用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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