When using the back button of IE or history.go(-1) on the web page, what we see will be the cached page, but after using session_start, this function will force the current page not to be cached, resulting in " Warning: The page has expired."
Solution 1:
Add a sentence
after session_start代码如下 | 复制代码 |
header("Cache-control: private"); |
Note that the program cannot produce any output before this.
Solution 2:
Add
before session_start代码如下 | 复制代码 |
session_cache_limiter('private'); |
//Do not clear the form, only while the session is in effect
代码如下 | 复制代码 |
session_cache_limiter还有另两个参数的含义: session_cache_limiter('nocache');// 清空表单 session_cache_limiter('public'); //不清空表单,如同没有使用session |
Solution 3
Change the configuration file php.ini. Place this file in
代码如下 | 复制代码 |
session.cache_limiter = nocache |
changed to
代码如下 | 复制代码 |
session.cache_limiter = 或者session.cache_limiter = none |
and then restart apache.