Re: store class zithin session

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

 



On 20 Nov 2008, at 11:01, Alain Roger wrote:
i have a class and i would like to store it zithin session.
i was thinking to use serialize/unserialize but it does not work.

any idea how to do it ?

Alain, you've been on this list long enough to know that "it does not work" is not enough information for people to be able to help you.

Firstly there is no need to serialise anything going into the session. Secondly I assume you want to store objects not classes. Thirdly there is no reason why it should not work, but there are some caveats you need to be aware of...

* The class definition must have been loaded before session_start() is called, otherwise you'll end up with an object of type stdClass rather than your class.

* Resources stored inside the object must be cleaned up in __sleep() and can be recreated in __wake() as they will not be stored in the session along with the rest of the object.

If you still can't get it to work after reading this, send us the code.

-Stut

--
http://stut.net/

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