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 re-browsing methods: (1) Open new window value is private, No-cache, Must-revalidate, then open new window Access will re-access the server. If the Max-age value is specified, then the server will not be re-accessed in the time within this value, for example: Cache-control:max-age=5 (indicating that access will not go to the server within 5 seconds of accessing this page) (2) In the Address bar The return value is private or must-revalidate the server is accessed only on the first visit, and is no longer 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 the Back button to the value of private, Must-revalidate, Max-age, will not be re-access, the value is No-cache, each time repeated access (4) Press the Refresh button regardless of why the value, will be repeated access to the Cache-control value of " 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: Prohibit the page in IE cache HTTP Response message header settings: CacheControl = No-cachepragma=no-cacheexpires = -1expires is a good thing, if the Web page on the server changes frequently, set it to 1, Indicates an 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 through 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 header common directives are divided into three parts: the first part is the version of the HTTP Protocol (http-version), the second part is the status code, and the third part is the reason phrase (reason-phrase). Send a 404 Status Code header ("http/1.1 404 Not Found") to the browser, or header ("http/1.1 404″);//Permanently redirect header (" location:http:// Hi.baidu.com/3800_hk ");//default is 301 Jump//Temporary REDIRECT header (" http/1.1 302 Found "); Header (" location:http://hi.baidu.com/3800_ HK ");//Download the file header (" Content-type:text/plain "); Can be replaced with the MIME type you need header (' content-disposition:attachment; filename= ' Weizhifeng.txt "'); ReadFile (' Weizhifeng.txt ') Other header information can refer to http/1.1 specification if the output has already been made before the header, use the Ob_start () function.
Override X-powered-by:php:header (' x-powered-by:php/4.4.0 '); header (' x-powered-by:brain/0.6b ');//Document Language header (' Content-language:en ');//Tell the browser last modified time $time=time ()-60; or Filemtime ($FN), Etcheader (' last-modified: '. Gmdate (' d, D M Y h:i:s ', $time). ' GMT ');//Tell the browser that the document content has not changed header (' http/1.1 304 not Modified ');//Set Content Length header (' content-length:1234 ');// Set to a download type header (' Content-type:application/octet-stream '); header (' content-disposition:attachment; Filename= ') Example.zip "'); header (' content-transfer-encoding:binary ');//load the file to Send:readfile (' example.zip ');// Disables the cache header for the current document (' Cache-control:no-cache, No-store, max-age=0, Must-revalidate '); header (' Expires:mon, 1997 Jul 05:00:00 GMT '); Date in the Pastheader (' Pragma:no-cache ');//Set Content Type: Header (' content-type:text/html; charset=iso-8859-1 '); Header (' content-type:text/html; Charset=utf-8 '); header (' Content-type:text/plain '); Plain Text Format header (' Content-type:image/jpeg '); JPG Image header (' Content-type:application/zip '); ZIP file headER (' content-type:application/pdf '); PDF file Header (' Content-type:audio/mpeg '); Audio file header (' Content-type:application/x-shockwave-flash '); Flash animation//Display Login Dialog header (' http/1.1 401 Unauthorized '); header (' Www-authenticate:basic realm= ' Top Secret '); print ' Text that would be displayed if the user hits cancel or ';p rint ' enters wrong login data ';? >