PHP back one page form content Save Implementation Method _php Tutorial

Source: Internet
Author: User
Tags php form
PHP forms are backed up after submission, and the contents of the form are emptied by default (when using Session_Start).
The workaround is after Session_Start (), the character output is written before the
Copy CodeThe code is as follows:
Header ("Cache-control:private");

The cache of the Web page is controlled by the "Cache-control" in the HTTP message header, and the common values are private, No-cache, Max-age, must-revalidate, etc., and the default is private. Its function is divided into the following situations according to different ways of re-browsing:
(1) Open a new window
The value is private, No-cache, Must-revalidate, and the server will be re-accessed when a new window is opened.
If you specify a max-age value, the server is not re-accessed in the time within this value, for example:
Cache-control:max-age=5 (indicates that access will not go to the server within 5 seconds of accessing this page)
(2) Enter in the Address bar
A value of private or must-revalidate will only access the server on the first visit and will no longer be accessed at a later time.
The value is No-cache, which is accessed every time.
A value of max-age, the access is not repeated until it expires.
(3) Press Back button
The value is private, must-revalidate, Max-age, and is not re-accessed.
A value of No-cache, which is repeatedly accessed every time
(4) Press the Refresh button
No matter what the value, it will be accessed repeatedly
When the Cache-control value is "No-cache", accessing this page does not leave a page backup in the Temporary Internet Article folder.
Also, the cache is affected by specifying a value of "Expires". For example, specifying the Expires value is a time long past, then when you visit this network repeatedly press ENTER in the Address bar, then each time will be repeated access: Expires:fri, Dec 1999 16:00:00 GMT
For example: Prevent pages 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 changes frequently, it is set to 1, indicating immediate expiration. If a webpage is updated daily 1 o'clock in the morning, you can set 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 page.
Legacy HTTP 1.0 Servers cannot use the Cache-control header.
So for backwards 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 the Pragma:no-cache header in the response,
Internet Explorer does not cache this response. Note: Pragma:no-cache prevents caching only when used in a secure connection, and if used in a non-secure page, is processed in the same way as expires:-1, the page is cached but is marked for immediate expiration.
Cache-control Message Header Field description
CACHE-CONTROL Specifies the caching mechanism that requests and responses follow. Set in a request message or response message
Cache-control does not modify the caching process in another message processing process. The cache directives for the 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 shared with the cache. This allows the server to simply describe a partial response message for the user, and this response message is not valid for another user's request.
No-cache indicates that a request or response message cannot be cached
No-store is used to prevent the inadvertent release of important information. Sending in the request message will make the request and response messages do not use the cache.
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 a response that is less than the current time plus a specified time.
Max-stale indicates that the client can receive a response message that exceeds 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.

http://www.bkjia.com/PHPjc/325542.html www.bkjia.com true http://www.bkjia.com/PHPjc/325542.html techarticle after the PHP form is submitted and then back, the contents of the form are emptied by default (when using Session_Start), and the workaround is to write the copy code generation before the character output after Session_Start ().

  • Related Article

    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.