Re: Session persistent objects
| From: | Stut | Date: | Mon, 18 Jun 2007 12:52:33 +0000 |
| Subject: | Re: Session persistent objects | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257274@lists.php.net to get a copy of this message | ||
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/