Re: Session persistent objects

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

 



Please include the list when replying.

Markus Feier wrote:
I thought I read somewhere, there could be a problem storing objects in
sessions.

Do you mean
$_SESSION['objectid']=new classx...

I do indeed mean that. There are a few things you need to be aware of...

* When you call session_start() you must already have included the necessary that defines the classes that might have instances in the session, or have an __autoload function that can load them on demand.

* As always you cannot store resources in the session. To get around this for objects, implement __sleep and __wake methods to dispose of and recreate the resources. Check the manual for full details.

-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