NYCPHP Meetup

[nycphp-talk] Disappearing $_SESSION variables after using header ()

Chris Shiflett shiflett at php.net
Tue Nov 25 10:29:36 EST 2008


> > Also, and I think that is in one of the annotations on php.net for  
> header(),
> > when using the header() redirect explicitly write the values to  
> the session
> > (of course I forgot the command for that).
>
> session_write_close();

The reason this isn't in the manual is that it's wrong. $_SESSION is  
serialized and stored in the session data store at the end of  
execution. The Location header is just a header; nothing different  
happens until the request is received by the client.

Hope that helps.

Chris

--
Chris Shiflett
http://shiflett.org/







More information about the talk mailing list