The php + ajax session is set to $ _ SESSION [& quot; newname & quot;]. after refreshing, the application without adding users is preceded by reguser. php with & nbsp; & lt ;? Php & nbsp; session_start (); & nbsp; echosession_id (). & quot; & lt; br & gt; & quot; the php + ajax session is set to $ _ SESSION ["newname"], and is missing after refreshing.
Add user applications
The preceding figure is reguser. php.
Session_start ();
Echo session_id ()."
";
Echo $ _ SESSION ["newname"];
------ Below is jquery's $. post to adduser. php, add a user
?>
Ajax page: adduser. php
Inside
Session_start ();
If it is added successfully, the value is assigned: $ _ SESSION ["newname"] = $ newname;
The problem is that the page is successfully added. for the first time, the home page can read echo $ _ SESSION ["newname"]; but the page disappears after a refresh, and the tmp folder storing the session is empty.
Why does the session [newname] disappear after refreshing ??
------ Solution --------------------
Check whether the session. gc_maxlifetime in your PHP. ini file is too short.
------ Solution --------------------
Is refresh submitted once and post submitted a null value?
------ Solution --------------------
Very likely
Discussion
Is refresh submitted once and post submitted a null value?