Re: serialize() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
Jochem:

$_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.

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++;


tedd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux