Two methods of supporting page backward using PHP program _php skill

Source: Internet
Author: User
Tags current time
First, use the header method to set the message header Cache-control


QUOTE:
Header (' Cache-control:private, Must-revalidate '); Support page Bounce

Second, using the Session_cache_limiter method


QUOTE:
Note to write before the Session_Start method
Session_cache_limiter (' Private, must-revalidate ');

Add:
Cache-control Message Header Field description
CACHE-CONTROL Specifies the caching mechanism that the request and response follow. Setting Cache-control in a request message or in a response message does not modify the caching process during another message handling process. The cached instructions at request include No-cache, No-store, Max-age, Max-stale, Min-fresh, only-if-cached, and the instructions in the response message include public, private, No-cache, No-store, No-transform, Must-revalidate, Proxy-revalidate, Max-age. The instructions in each message have the following meanings:

Public indicates that the response can be cached by any buffer.

Private indicates that the entire or partial response message for a single user cannot be handled by the shared cache. This allows the server to simply describe a partial response message from the user, which is not valid for other users ' requests.

No-cache indicates that a request or response message cannot be cached

No-store is used to prevent important information from being inadvertently released. Sending in a request message will not use caching for both request and response messages.

Max-age indicates that the client can receive a response that is not longer than the specified time in seconds.

Min-fresh indicates that the client can receive response times that are less than the current time plus a specified time.

Max-stale indicates that the client can receive response messages that exceed the timeout period. If you specify a value for the Max-stale message, the client can receive a response message that exceeds the specified value for the timeout period.



About the form refresh

Q: Why did I click on the Back button of the browser and all the fields were emptied?

A: This is because you used the Session_Start function in your form submission page. This function forces the current page to not be cached. The solution is to add the header ("Cache-control:private") after your session_start function; Note that your PHP program cannot have any output before the bank.

Add: There is also a session based solution, preceded by the Session_Start


QUOTE:
Session_cache_limiter (' NoCache ');/clear the form
Session_cache_limiter (' private '); Do not empty the form, only during session effective
Session_cache_limiter (' public '); Do not empty the form, as if not using the session general

can be Session_Start (), preceded by Session_cache_limiter ("private,max-age=10800");

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.