The header is a string sent by the server to the browser before the HTML data is transmitted to the HTTP, in the header
There is an empty line separating the HTML file. For a detailed description of HTTP, you can refer to RFC 2068 official documents
(http://www.w3.org/Protocols/rfc2068/rfc2068). Before sending the HTML data back to PHP, you should
All headers are passed through.
Note: The traditional header must contain one of the following three headers and can only occur once.
Content-type:xxxx/yyyy
Location:xxxx:yyyy/zzzz
status:nnn xxxxxx
In the new multi-type header specification (Multipart MIME) The party can appear more than two times.
Usage examples
Example one: This example redirects the browser to the official PHP website.
Header ("Location:http://www.php.net");
Exit
?
Example two: Users can get the latest information each time, rather than Proxy or cache data, you can use the following headers
Header ("Expires:mon, Jul 1997 05:00:00 GMT");
Header ("last-modified:".) Gmdate ("D, D M Y h:i:s"). "GMT");
Header ("Cache-control:no-cache, must-revalidate");
Header ("Pragma:no-cache");
?
Example three: Let the user's browser appear unable to find the file information.
Header ("status:404 not Found");
?
Example four: Let the user download the file.
Header ("Content-type:application/x-gzip");
Header ("content-disposition:attachment; Filename= file name ");
Header ("Content-description:php3 Generated Data");
?
http://www.bkjia.com/PHPjc/531887.html www.bkjia.com true http://www.bkjia.com/PHPjc/531887.html techarticle a header is a string that is sent by the server to the HTML file before the HTTP literal to the browser, and a blank line is separated between the header and HTML files. For a detailed description of HTTP, you can ...