Re: serialize() function
| From: | Jochem Maas | Date: | Fri, 14 Apr 2006 19:12:59 +0000 |
| Subject: | Re: serialize() function | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234015@lists.php.net to get a copy of this message | ||
tedd wrote:
Jochem:no shit! (regarding the confusion). $_SESSION is populated when you call session_start(), it's contents are stored on the server. calling session_start() implicitly make php emit a cookie which contains not much other than the session id - it's this id (that the browser sends back in the form of a cookie again) that tell's php which chunk of serialized data that it saved onto disk (usually onto disk) at the end a previous request it should load up when you call session_start(). by default the session cookie is 'dropped' by the browser once you close it [the browser] try this, it might to help you see what's happening a bit (oh and don't forget the manual ;-): <?php session_start(); if (!isset($_SESSION['myObj'])) { echo "INIT!<br />"; $_SESSION['myObj'] = new stdObject; $_SESSION['myObj']->counter = 1; } echo $_SESSION['myObj']->counter++;$_SESSION has another advantage - everything you stick in it is automagically serialized and unserialized at end/start of the request.I didn't know that. Thanks, now I have to figure out a way to store a $_SESSION in a cookie and read it back without inferring with what the user is currently doing in both post and get selections. I have myself overly confused at the moment with too much user activity.
tedd