| Have you ever encountered such a situation: when a form error occurs and the page is returned, all the information you have filled out is missing. This article introduces two methods to support php page rollback for your reference.
Method 1: Use the Header method to set the message Header Cache-control
Header ('cache-control: private, must-revalidate'); // supports page jump back
Method 2: Use the session_cache_limiter method.
// It must be written before the session_start method; otherwise, an error is returned. Session_cache_limiter ('private, must-revalidate ');
The Cache-Control Message header field specifies the Cache mechanism for requests and responses. Setting Cache-Control in a request message or response message does not modify the Cache processing process of another message. The cache commands in the request include no-cache, no-store, max-age, max-stale, min-fresh, only-if-cached, commands in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, and max-age.
Message instructions: 1. Public indicates that the response can be cached in any cache area. 2. Private indicates that the whole or part of the response message of a single user cannot be processed by the shared cache. This allows the server to only describe part of the user's response message, which is invalid for requests of other users. 3. no-cache indicates that the request or response message cannot be cached. 4. no-store is used to prevent the unintentional release of important information. Sending a request message does not cache the request and response messages. 5. max-age indicates that the client can receive responses with a lifetime not greater than the specified time (in seconds. 6. min-fresh indicates that the client can receive a response whose response time is earlier than the current time plus the specified time. 7. max-stale indicates that the client can receive response messages beyond the timeout period. If the value of the max-stale message is specified, the client can receive response messages that exceed the timeout period. For more information about cache-control, see: php file header (header.
>>> Articles you may be interested in: Summary of page jump code (PHP, asp, and js multi-version) in various methods of php page jump) PHP Header page jump considerations php url redirection (page jump) code php implementation page jump a different method php implementation page jump several methods header jump and include contains problem instance analysis |