Php page rollback implementation methods-php Tutorial

Source: Internet
Author: User
Php page rollback implementation methods
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

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.