简体   繁体   中英

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?

尝试使用session_regenerate_id函数: 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM