Whats the easiest way to determine if a user is online? (PHP/MYSQL)

前端 未结 10 1244
轻奢々
轻奢々 2020-12-02 05:24

Is there a way I can piggy back sessions to know if the user is online?

I.e: use logs on, I set a $_SESSION variable, user times out- cookie Garbage collector update

10条回答
  •  半阙折子戏
    2020-12-02 05:51

    One thing I would advise is to store this kind of information in memory with for example memcached or mysql heap or redis. Because otherwise the database will be hit a lot.

提交回复
热议问题