What we are going to introduce to you today is about
// PHP header function sends 404 status code to the browser
header(“HTTP/1.1 404 Not Found”);
or
header(“HTTP/1.1 404″);
// PHP header function permanently redirects
header(“Location: http ://weizhifeng.net/”);//The default is 301 jump
// Temporary redirection
header(“HTTP/1.1 302 Found”);
header(“Location: http:/ /weizhifeng.net/”);
// PHP header function 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 HTTP /1.1 specification
If there is already output before the PHP header function, please use the ob_start() function