The php + ajax session is set to $ _ SESSION ["newname"]. after refreshing, no more information is available. how can this problem be solved?

Source: Internet
Author: User
Tags tmp folder
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.