Two methods to allow PHP to support page Rollback

Source: Internet
Author: User
During the development process, the information filled in when the page is returned due to a form error is often lost. to support page jump, you can use two methods.

During the development process, the information filled in when the page is returned due to a form error is often lost. to support page jump, you can use two methods.

First, apply the Header method to set the message Header Cache-control

Header ('cache-control: private, must-revalidate'); // supports page bounce

Second, apply the session_cache_limiter method.

// Be sure to write it before the session_start method.
Session_cache_limiter ('private, must-revalidate ');

PS: clarified the Cache-Control Message header domain
Cache-Control specifies the Cache mechanism for requests and responses. Setting Cache-Control in a request message or response message does not correct the Cache processing process in another message processing process. Cache commands in the request include no-cache, no-store, max-age, max-stale, min-fresh, only-if-cached, the commands in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, and max-age. The instructions in each message are as follows:

The Public instigating response can be cached in any cache area.
Private: all or part of the response messages of a single user cannot be shared and cached for processing. This allows the server to only describe part of the user's response message, which is invalid for other users' requests.
No-cache: request or response messages cannot be cached
No-store is used to prevent the unintentional announcement of important information. Sending in a request message does not cache the request and response message.
Max-age allows the client to receive responses with a lifetime not greater than the specified time (in seconds.
The min-fresh command allows the client to receive a response whose response time is earlier than the current time plus the specified time.
Max-stale allows the client to receive response messages beyond the time limit. If the value of the max-stale message is specified, the client can receive response messages beyond the value specified in the hyper-era.

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.