开发者

Best way to list online users with PHP but without MySQL?

开发者 https://www.devze.com 2022-12-27 11:05 出处:网络
I want to make a script that will list online users when they enter a page. Simple way is record newly entered users into MySQL and list them for example every second.

I want to make a script that will list online users when they enter a page. Simple way is record newly entered users into MySQL and list them for example every second. But I don't think it's a good idea with tons of users like in a facebook app come in and out of the page. There would be a way with Flash and PHP sockets but I really don't want to use Flash either. So is 开发者_C百科there any option left?


Maybe you can use Memcache to store the users' information such as sessions for large amount of frequent query.I think it's an easy and effective way to do your job.


Assuming you are using a login sistem so you have all the info you need stored somewhere in your database!

you can use sessions!

  • http://php.net/manual/en/ref.session.php

here there is also a solution on stackoverflow

  • Find Number of Open Sessions
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号