//Define the encoding
//Atom
//CSS
//Javascript
//JPEG Image
//JSON
//PDF
//RSS
//Text (Plain)
//XML
// ok
//Set a 404 header:
//Set the address to be permanently redirected
//Go to a new address
// File delayed turn:
// override X-Powered-By: PHP:
//Document language
//Tell the browser the last time it was modified
//Tell the browser that the document content has not changed
//Set content length
//Set as a download type
// Disable cache for the current document
//Set content type:
//Show the login dialog box
Copy the codeThe code is as follows:
header( 'Content-Type:text/html;charset=utf-8 ');
//Atom
Copy the codeThe code is as follows:
header('Content-type: application/atom+xml');
//CSS
Copy the codeThe code is as follows:
header('Content-type: text/css');
//Javascript
Copy the codeThe code is as follows:
header('Content-type: text/javascript');
//JPEG Image
Copy the codeThe code is as follows:
header('Content-type: image/jpeg');
//JSON
Copy the codeThe code is as follows:
header('Content-type: application/json');
Copy the codeThe code is as follows:
header('Content-type: application/pdf');
//RSS
Copy the codeThe code is as follows:
header('Content-Type: application/rss+xml; charset=ISO-8859-1');
//Text (Plain)
Copy the codeThe code is as follows:
header('Content-type: text/plain');
//XML
Copy the codeThe code is as follows:
header('Content-type: text/xml');
// ok
Copy the codeThe code is as follows:
header('HTTP/1.1 200 OK');
//Set a 404 header:
Copy the codeThe code is as follows:
header('HTTP/1.1 404 Not Found');
//Set the address to be permanently redirected
Copy the codeThe code is as follows:
header('HTTP/1.1 301 Moved Permanently');
//Go to a new address
Copy the codeThe code is as follows:
header('Location: /');
// File delayed turn:
Copy the codeThe code is as follows:
header('Refresh: 10; url=/');
print 'You will be redirected in 10 seconds';
//Of course, it can also be implemented using html syntax
// <meta http-equiv="refresh" content="10;/ />
print 'You will be redirected in 10 seconds';
//Of course, it can also be implemented using html syntax
// <meta http-equiv="refresh" content="10;/ />
// override X-Powered-By: PHP:
Copy the codeThe code is as follows:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
header('X-Powered-By: Brain/0.6b');
//Document language
Copy the codeThe code is as follows:
header('Content-language: en');
//Tell the browser the last time it was modified
Copy the codeThe code is as follows:
$time = time() - 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
//Tell the browser that the document content has not changed
Copy the codeThe code is as follows:
header('HTTP/1.1 304 Not Modified');
//Set content length
Copy the codeThe code is as follows:
header('Content-Length: 1234');
//Set as a download type
Copy the codeThe code is as follows:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=""');
header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile('');
header('Content-Disposition: attachment; filename=""');
header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile('');
// Disable cache for the current document
Copy the codeThe code is as follows:
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 past
header('Pragma: no-cache');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');
//Set content type:
Copy the codeThe code is as follows:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); //plain text format
header('Content-Type: image/jpeg'); //JPG***
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio file
header('Content-Type: application/x-shockw**e-flash'); //Flash animation
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); //plain text format
header('Content-Type: image/jpeg'); //JPG***
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio file
header('Content-Type: application/x-shockw**e-flash'); //Flash animation
//Show the login dialog box
Copy the codeThe code is as follows:
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';
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';