Re: Objects in Session variables ?

From: Date: Fri, 05 Jan 2001 11:03:31 +0000
Subject: Re: Objects in Session variables ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32867@lists.php.net to get a copy of this message
Hello Alain, Friday, January 05, 2001, 12:38:56 AM, you wrote: AF> In my current PHP4 project, I have a "User" class, amongst a couple of other AF> classes. What I'd like to is: when the user logs on to the site, store his AF> personal "User" object in a session variable so that I can easily access all AF> of his information from any page without having to requery the database to AF> get that information. Is this possible, e.g. can one simply AF> session_register() an instance of a PHP class, even if I'll lose the methods AF> and only keep the member variables ? Of course you can. The class will be recreated next time the page is hit within one session. Don't forget to include a class definition before the session_start(), so the class could be recreated normally (PHP will throw an error if you don't). -- Best regards, Max A. Derkachev mailto:kot@books.ru Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia  

« previous php.general (#32867) next »