|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-10-10 10:16 UTC] freeng at qq dot com
Description: ------------ --- From manual page: http://www.php.net/function.session-regenerate-id --- 1.set the different value by session_name() to the php.ini (normal when the same value) 2.set some session value. 3.at new request,the value will lose Test script: --------------- //php.ini session.name=ab; session_name('cd'); session_regenerate_id(); $_SESSION['a'] = 1; //current request $_SESSION=['a'=>1]; //new request $_SESSION=[]; PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Your problem is that you have more than one call to session_start(), and the second call fails just like the documentation says it should. If you have already used session_start() then you cannot call it again with calling session_write_close() beforehand. Your code should be as follows: session_start(); session_name('newname'); session_regenerate_id(); session_write_close(); session_start();