Question

I am trying to make a online chatting application.

How do I make a variable persist across users logged in from machines from different places in PHP?

I tried using session_write_close method but didn't work out.

Please guide with a step by step procedure. Many thanks.

Était-ce utile?

La solution

Sessions are per-browser. The session id is most commonly stored in browser cookies, or it can be passed around directly with each request. Either way, you cannot use the same session on different computers, not even multiple browsers on the same computer.

Instead of persisting the session, you can persist variables the same way you store user configurations, for example by saving settings in a database. The variables you want to store should be tied to the user account, not to the session.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top