I can't change PHP session id
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
精彩评论