Re: Session_unset - session_destroy issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 Aug 2013, at 19:16, dealTek <dealtek@xxxxxxxxx> wrote:

> Hi all,
> 
> I am having trouble with session_destroy - session_unset and $_SESSION = array()... I am trying to STOP and destroy all session vars......
> 
> 
> with the simple code test below I would think it would echo test 1 BUT FAIL on test2 
> - however it shows both for me...
> 
> how do I UNSET - DESTROY SESSIONS?
> 
> 
> <?php
> 
> 
> session_start();
> 
> $_SESSION['var1'] = 'test1';
> echo '<br /> test1 '. $_SESSION['var1'].' ';
> 
> session_unset();
> session_destroy();
> $_SESSION = array();
> 
> 
> $_SESSION['var1'] = 'test2';
> 
> echo '<br /> test2 ' . $_SESSION['var1'];
> 
> 
> 
> ?>

The $_SESSION superglobal variable is nothing more than that. Calling session_start will populate it with an existing session, and when the request ends the contents will be stored. Once you've closed or destroyed the session it does not stop working because it's nothing more than a superglobal variable, it just won't be stored at the end of the request.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux