PHP back one page form content Save Implementation method _php tips

Source: Internet
Author: User
PHP forms are backed up after submission, and the contents of the form are emptied by default (when using Session_Start),
The workaround is to write the character output before the session_start ()
Copy Code code as follows:

Header ("Cache-control:private");

The caching of the Web page is controlled by the "Cache-control" in the HTTP message header, the common value has private, No-cache, Max-age, must-revalidate, etc., the default is private. Its role is divided into the following situations according to different ways of re browsing:
(1) Open a new window
Value is private, No-cache, and Must-revalidate, the server will be accessed again when a new window is opened.
If the Max-age value is specified, the server is not again accessed within the time of this value, for example:
Cache-control:max-age=5 (for 5 seconds after accessing this page will not go to the server)
(2) Enter in the Address bar
A value of private or must-revalidate accesses the server only for the first visit and is no longer accessible.
Value is No-cache, then it is accessed every time.
Value is Max-age, the access is not repeated until it expires.
(3) Press the Back button
Value is private, must-revalidate, and Max-age, it will not be accessed again.
Value is No-cache, the access is repeated each time
(4) Press the Refresh button
Regardless of the value, repeated access
When the Cache-control value is "No-cache", accessing this page does not leave a page backup on the Internet temporary article folder.
In addition, caching can also be affected by specifying a "Expires" value. For example, to specify that the Expires value is a long past time, if you repeatedly press ENTER in the Address bar when you visit the network, you will repeat the visit each time: Expires:fri, Dec 1999 16:00:00 GMT
For example: Prevent the page from being cached in IE
HTTP response message Header settings:
CacheControl = No-cache
Pragma=no-cache
Expires =-1
Expires is a good thing, if the Web page on the server often changes, set it to-1, indicating immediate expiration. If a page is updated daily 1 o'clock in the morning, you can set the expires to 1 o'clock in the morning the next day.
When the HTTP1.1 server specifies CacheControl = No-cache, the browser does not cache the Web page.
Legacy HTTP 1.0 Servers cannot use Cache-control headers.
So for backward compatibility with HTTP 1.0 servers, IE uses the Pragma:no-cache header to provide special support for HTTP.
If the client communicates with the server over a secure connection (https://) and the server returns Pragma:no-cache headers in the response,
Then Internet Explorer does not cache this response. Note: Pragma:no-cache only prevents caching when used in a secure connection, and if used in an unsecured page, the processing is the same as expires:-1, and the page is cached but marked as immediately expired.
Cache-control Message Header Field description
CACHE-CONTROL Specifies the caching mechanism that the request and response follow. Set in the request message or in the response message
Cache-control does not modify the caching process during another message processing 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.

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.