Note: This article is transferred from the csdn website.
PHPLanguage description
Html. The header is the string sent by the server before the server passes HTML data to the browser using HTTP co-definition. A blank line is required between the header and the HTML file. For a detailed description of HTTP, refer to the RFC 2068 official file (http://www.w3.org/Protocols/rfc2068/rfc2068 ). Before sending HTML data back to PhP, you must upload all the headers. Note: The traditional header must contain one of the following three headers and can only appear once.
Content-Type: xxxx/YYYY
Location: xxxx: yyyy/zzzz
Status: NNN xxxxxx
The new multipart MIME type can appear more than twice.
Example
Example 1: redirect the browser to the official PHP website..
<? PHP
Header ("Location: http://www.php.net ";);
Exit;
?>
Example 2: force the user to obtain the latest data every time, instead of the data in the proxy or cache (the client cache), you can use the following Header
<? PHP
Header ("expires: Mon, 26 Jul 1997 05:00:00 GMT"); // set the time
Header ("last-modified:". gmdate ("D, D m y h: I: s"). "GMT ");
Header ("cache-control: No-cache, must-revalidate"); // The control page does not use the cache.
Header ("Pragma: No-Cache ");
?>
Example 3: make the user's browser unable to find the file information and control the access permission.
<? PHP
Header ("status: 404 Not Found ");
?>
Example 4: download an object. <? PHP
Header ("Content-Type: Application/X-gzip ");
Header ("content-Disposition: attachment; filename = file name ");
Header ("content-descr resume ption: php3 generated data ");
?>