Re: session lost problem

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

 



On 24 Apr 2012, at 05:58, bug zhu wrote:

> there are tow php files a.php and b.php,
> 
> content of a.php as follows:
> <?php
> session_start();
> if (!isset($_GET['flag']))
> {
> header('Location: b.php');
> }
> else
> {
> var_dump($_SESSION);
> }
> 
> content of  b.php as follows:
> <?php
> session_start();
> session_commit();
> $_SESSION['test'] = 'test';
> session_commit();
> header('Location: a.php?flag=1');
> 
> when i visit a.php, the dumped $_SESSION array is empty
> but if i commented the first session_commit() in b.php and then visit
> a.php, i cound see the $_SESSION array,which is not empty
> i wish i have descibed  clear about my problem and someone could give me a
> feedback~


I'm really not clear on what you're trying to do here, but the behaviour you're describing is as designed. When you call session_commit() you are saving and closing the session, so nothing done to $_SESSION after that point will be saved, even if you call session_commit() again.

-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