Re: Re:clases en sesiones
| From: | Jochem Maas | Date: | Fri, 05 Jan 2007 23:53:34 +0000 |
| Subject: | Re: Re:clases en sesiones | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246658@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
> On Fri, January 5, 2007 4:36 pm, Stut wrote:
>> 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.
>
> Another possibility...
>
> Do a session_write_close() to kill of the auto_start session.
>
> Then, using session_name() and session_id() and
> session_set_cookie_params() force your OWN session control, completely
> independent of the auto_start session, which you can do AFTER you have
> done your include()s
you sneaky oldskool b'std ;-)
>
> This should allow you to do what you want with the fewest conceptual
> changes, at the price of a bogus auto_start session being wastefully
> used by your webhost -- which seems pretty brain-dead to me, but there
> it is.
>