Home >Backend Development >PHP Tutorial >PHP function header releases HTTP header information_PHP tutorial
// Send 404 status code to the browser
header(“HTTP/1.1 404 Not Found”);
or
header (“HTTP/1.1 404″);
// Permanent redirection
header(“Location: http://weizhifeng.net/”);//The default is 301 jump
/ / Temporary redirection
header(“HTTP/1.1 302 Found”);
header(“Location: http://weizhifeng.net/”);
// Download 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');
For other header information, please refer to the HTTP/1.1 specification
If there is output before the header, please use the ob_start() function.
http://www.bkjia.com/PHPjc/445995.html