10-30-2010, 06:49 PM
|
#22 (permalink)
|
|
The Visitor
Join Date: Jun 2010
Location: Hermosillo
Posts: 2
Thanks: 0
|
Hi Roman,
Your code is OK, but you need to know some about the HTTP environment and how PHP works.
When the browser request to your resource (your script in this case), the vars and clases in PHP are initialized,and a thread in the server is open to attend your request. Until the thread is ended, all your vars and temporary memory in the server are cleaned, so if you try to access your var in the next request, your vars doesn't exist anymore because them ware cleaned for ending of the Thread of the previous request.
To keep your vars for global, you can implement MemCache, you need to install the Mem Cache server, it allows you to allocate primitive vars and objects, and then retrieve them any time in any request, by this way, you keep the state of your var globally for all users.
I hope that this was helpfully for you.
Regards
|
|
|