Detailed usage of the PHPheader function. Today, we will introduce the PHPheader function to send the 404 status code header (HTTP1.1404NotFound) to the browser, or the header (HTTP1.1404 ); the PHPheader function is permanently duplicated.
// The PHP header function sends a 404 status code to the browser.
Header ("HTTP/1.1 404 Not Found ");
Or
Header ("HTTP/1.1 404 ″);
// PHP header function permanent redirection
Header ("Location: http://weizhifeng.net/"); // The default value is 301.
// Temporary redirection
Header ("HTTP/1.1 302 Found ");
Header ("Location: http://weizhifeng.net /");
// PHP header function download file
Header ("Content-type: text/plain '); // you can replace it with the MIME type you need.
Header ('content-Disposition: attachment; filename=%weizhifeng.txt "');
Readfile('weizhifeng.txt ');
For other header information, refer to HTTP/1.1 specification
If you have output before the PHP header function, use the ob_start () function.
The authorization // PHP header function sends the 404 status code header (HTTP/1.1 404 Not Found) to the browser, or the header (HTTP/1.1 404 ); // The PHP header function is permanently duplicated...