如何计算网站上的在线用户 [英] How to count online users on a website

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

问题描述

可能的重复项:
脚本告诉我谁,以及多少用户,处于在线状态
跟踪当前在线用户的最佳方法

Possible Duplicates:
script to tell me who, and how many users, are online
Best way to keep track of current online users

如果不必登录,我应该如何在特定时间在PHP网站上在线统计人数?

How should I count the people online on a PHP website at a given time, if they don't have to be logged-in?

推荐答案

使用cookie来标识唯一用户,然后只需跟踪上次访问PHP页面的时间即可.然后提出超时机制-例如,如果他们在15分钟内没有访问页面,则将其从计数中删除.

Use a cookie to identify unique users, and then just keep track of the last time accessed a PHP page. Then come up with a timeout mechanism - for example, if they have not accessed a page in 15 minutes then they are removed from the count.

这篇关于如何计算网站上的在线用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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