In the development process, often appear the form error and return the page when the information is all lost, in order to support page bounce, you can use the following two ways to achieve.
1. Use header header to set cache control header Cache-control.
PHP code
- Header (' Cache-control:private, Must-revalidate '); Support page Bounce
2. Use the Session_cache_limiter method.
PHP code
- Session_cache_limiter (' Private, must-revalidate '); To write before the Session_Start method
Here are the Session_cache_limiter parameters:
The meaning of several parameters in Session_cache_limiter is:
NoCache: Of course it is not cached (for example: the form information is cleared), but public variables can be cached
Private: Proprietary caching (for example: form information is retained but valid for the lifetime)
Private_no_cache: Private mode but not expired (form information is retained)
Publice: Public Way, (form information is also retained)
Set cache Expiration Time: Session_cache_expire function setting, default is 180 minutes.
Often encounter problems:
1. Session_cache_limiter ("private"); The form information is retained, but if I modify the information that has been submitted, the information presented by the form page or the information in the cache is not automatically refreshed in time, if not session_cache_limiter ( "Private"), and cannot keep form information
Solution:
Add in front of Session_Start
Session_cache_limiter ( "Private, Must-revalidate " ), you can