The header() function sends raw HTTP headers to the client.
Copy code The code is as follows:
//200 Normal state
header(' HTTP/1.1 200 OK');
// 301 permanent redirect, remember to add the redirection address Location:$url
header('HTTP/1.1 301 Moved Permanently');
// Redirect Orientation is actually 302 temporary redirection
header('Location: http://www.maiyoule.com/');
// Setting page 304 No modification
header('HTTP/1.1 304 Not Modified');
// Display the login box,
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Login information"');
echo 'Displayed information! ';
// 403 Forbidden
header('HTTP/1.1 403 Forbidden');
// 404 Error
header('HTTP/1.1 404 Not Found');
/ / 500 Server Error
header('HTTP/1.1 500 Internal Server Error');
// Redirect to the specified address after 3 seconds (that is, refresh to a new page with header('Content -Transfer-Encoding: binary');
readfile('example.zip');//Read the file to the client
//Disable page caching
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
//Set page header information
header('Content-Type: text/html; charset=iso-8859-1');
header('Content- Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
header('Content-Type: image/jpeg');
header ('Content-Type: application/zip');
header('Content-Type: application/pdf');
header('Content-Type: audio/mpeg');
header(' Content-Type: application/x-shockwave-flash');
//.... As for the value of Content-Type, you can check the w3c document library, which is very rich
?>
http://www.bkjia.com/PHPjc/824977.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824977.htmlTechArticleheader() function sends the original HTTP header to the client. Copy the code The code is as follows: ?php //200 normal status header('HTTP/1.1 200 OK'); // 301 permanent redirect, remember to add...