Re: Re:clases en sesiones

From: Date: Fri, 05 Jan 2007 22:36:38 +0000
Subject: Re: Re:clases en sesiones
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-246641@lists.php.net to get a copy of this message
Richard Lynch wrote:
WILD GUESS Search on php.net for __autoload I think that will let you figure out a way to get the auto_start session to automatically load your .class.php files, when it needs them.
Nice idea, unfortunately it doesn't work that way. In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. AFAIK when auto_start is on the session is started before any PHP is evaluated. I had to shift one of my frameworks around so that the __autoload was declared before session_start was called. I think Jochem may be on to something with the idea of using auto_prepend_file but I can't say for certain whether this is done before or after the auto_start. If it is before then you could declare the __autoload function in the prepended file and it should work. -Stut

« previous php.general (#246641) next »