RE: [PHP] Using unset with $_SESSION
| From: | Gryffyn, Trevor | Date: | Wed, 28 Jan 2004 22:14:03 +0000 |
| Subject: | RE: [PHP] Using unset with $_SESSION | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176134@lists.php.net to get a copy of this message | ||
Then there's session_destroy() too.
If I ever suggest something that seems correct on the surface, but
there's a good reason to use something else, even in particular cases,
feel free to let me know. I think I know PHP fairly well, but it's so
flexible and there are usually a dozen ways to do things, I find a way
that work and use it. I figure if you want to get rid of all your
session data, session_destroy() would do that.
Guess you'd have to do another session_start() after that though,
wouldn't you? Hmm.. See what happens when I use my brain?
-TG
> -----Original Message-----
> From: trlists@clayst.com [mailto:trlists@clayst.com]
> Sent: Wednesday, January 28, 2004 8:33 AM
> To: php-general@lists.php.net
> Cc: Ford, Mike [LSS]
> Subject: RE: [PHP] Using unset with $_SESSION
>
>
> > > Shouldn't unset($_SESSION) work?
> >
> > No. The following Caution appears in the manual (at
> >
> > http://www.php.net/manual/en/ref.session.php#session.examples):
> >
> > Caution Do NOT unset the whole $_SESSION with unset($_SESSION) as
> > this will disable the registering of session variables through the
> > $_SESSION superglobal.
>
> Thanks -- I have to say I missed that one!
>
> Thanks for noting session_write_close() as well. I did try that, but
> it didn't seem to offer any advantages over letting the script write
> the data on exit.
>
> ----------
> Tom Rawson
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>