开发者

I can't change PHP session id

开发者 https://www.devze.com 2023-03-07 07:07 出处:网络
I am trying to change session id by using session_unset(); and session_destroy(); 开发者_如何学编程

I am trying to change session id by using

session_unset();

and

session_destroy();
开发者_如何学编程

after I use session_start().

But I print session_id() after each session destroy and it didn't change in all browsers: IE8, Chrome and Firefox.

How is this caused and how can I solve it?


Try using the session_regenerate_id function: http://php.net/manual/en/function.session-regenerate-id.php


Try this from the PHP documentation :

session_start();
$_SESSION['destroyed'] = time();
session_regenerate_id();
unset($_SESSION['destroyed']);

http://php.net/manual/en/function.session-regenerate-id.php

0

精彩评论

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