Home  >  Article  >  Backend Development  >  About php5 session loss problem

About php5 session loss problem

藏色散人
藏色散人Original
2020-08-24 10:27:161886browse

php5 session loss solution: 1. Modify the "php.ini" configuration file; 2. Use "Fecade Session::get()" to obtain or use the assistant function "session()"; 3. Restart service, clear cache.

About php5 session loss problem

Recommended: "PHP Video Tutorial"

think session redirection is lost when using PHP5.1 Question

I checked a lot of information and also looked at the underlying code of redirect. Specifically, I found that there are multiple uses that are not quite right. Make a note to prevent forgetting:

When the session is lost after redirection:

1.php.ini configuration file, do not start automatically, the default is 0, session.auto_start=0 remains unchanged . Session.php in config can be set to open automatically.

2. Use Fecade Session::get() to obtain or use the helper function session(), do not use $_SESSION directly (it can be used after using the encapsulated session method, and the automatic session has been turned on)

3. After modification, be sure to restart the service and clear the cache. Many times the problem is corrected, but it does not take effect because the cache is not cleared, which wastes a lot of time.

The above is the detailed content of About php5 session loss problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn