开发者

Changing session variable after refresh/change page

开发者 https://www.devze.com 2023-01-26 07:47 出处:网络
I`ve problem with session variables on my page. session_start(); session_regenerate_id(); $_SESSION[\'test\'] = \'test\';

I`ve problem with session variables on my page.

session_start();
session_regenerate_id();
$_SESSION['test'] = 'test';

When i refresh page first time ['test'] is changing to ["test"]=> 开发者_JAVA技巧&string(4) "test" , after next refreshing page ["test"]=> &array(0) {}. Please help.


Try using session_write_close(); at the bottom of the page...

Are you using a header() redirect or anything of that nature? If so, this function ensures that the session variable is written before changing the page.


You need to set registry_globals = off to work right. I had the same problem in a rent server. Now everything is ok

0

精彩评论

暂无评论...
验证码 换一张
取 消