Share The PHPheader function usage tutorial. Copy the code as follows :? Phpfix404pages: header (http1.20. OK); set404header: header (HTTP1.1404NotFound); setMovedPermanentlyheader (goodforredricti
The code is as follows:
// Fix 404 pages:
Header ('http/1.1 200 OK ');
// Set 404 header:
Header ('http/1.1 404 Not Found ');
// Set Moved Permanently header (good for redrictions)
// Use with location header
Header ('http/1.1 301 Moved Permanently ');
// Redirect to a new location:
Header ('Location: http://www.example.org /');
// Redrict with delay:
Header ('refresh: 10; url = http://www.example.org /');
Print 'You will be redirected in 10 seconds ';
// You cocould also use the HTML syntax :// Header ('content-Transfer-Encoding: binary ');
// Load the file to send: readfile('example.zip ');
// Disable caching of the current document:
Header ('cache-Control: no-Cache, no-store, max-age = 0, must-revalidate ');
Header ('expires: Mon, 26 Jul 1997 05:00:00 GMT ');
// Date in the pastheader ('pragma: no-cache ');
// Set content type:
Header ('content-Type: text/html; charset = ISO-8859-1 ');
Header ('content-Type: text/html; charset = utf-8 ');
Header ('content-Type: text/plain ');
// Plain text file
Header ('content-Type: image/jpeg ');
// JPG picture
Header ('content-Type: application/zip ');
// ZIP file
Header ('content-Type: application/pdf ');
// PDF file
Header ('content-Type: audio/mpeg ');
// Audio MPEG (MP3 ,...) File
Header ('content-Type: application/x-shockwave-Flash ');
// Flash animation // show sign in box
Header ('http/1.1 401 unauthorized ');
Header ('www-Authenticate: Basic realm = "Top Secret "');
Print 'text that will be displayed if the user hits cancel or ';
Print 'enters wrong login data ';
?>
The http://www.bkjia.com/PHPjc/313653.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/313653.htmlTechArticle code is as follows :? Php // fix 404 pages: header ('http/1.1 200 OK '); // set 404 header: header ('http/1.1 404 Not Found '); // set Moved Permanently header (good for redricti...