As shown below:
Copy Code code as follows:
//Definition encoding
Header (' Content-type:text/html;charset=utf-8 ');
//atom
Header (' Content-type:application/atom+xml ');
//css
Header (' content-type:text/css ');
//javascript
Header (' Content-type:text/javascript ');
//jpeg Image
Header (' Content-type:image/jpeg ');
//json
Header (' Content-type:application/json ');
//pdf
Header (' content-type:application/pdf ');
//rss
Header (' Content-type:application/rss+xml; charset=iso-8859-1 ');
//text (Plain)
Header (' Content-type:text/plain ');
//xml
Header (' Content-type:text/xml ');
//OK
Header (' http/1.1 OK ');
//Set a 404 head:
Header (' http/1.1 404 Not Found ');
//Set address to be permanently redirected
Header (' http/1.1 moved Permanently ');
//Go to a new address
Header (' location:http://www.example.org/');
//File delay steering:
Header (' refresh:10; url=http://www.example.org/');
print ' You'll be redirected in seconds ';
//Of course, you can also use HTML syntax to implement
<meta http-equiv= "Refresh" content= "10;http://www.example.org//>
Override x-powered-by:php:
Header (' x-powered-by:php/4.4.0 ');
Header (' x-powered-by:brain/0.6b ');
//Document language
Header (' content-language:en ');
//Tell the browser the last modification time
$time = time ()-60; or Filemtime ($FN), etc
Header (' last-modified: ' Gmdate (' d, D M Y h:i:s ', $time). ' GMT ');
//Tell the browser that the contents of the document have not changed
Header (' http/1.1 304 not Modified ');
//Set content length
Header (' content-length:1234 ');
//Set to a download type
Header (' Content-type:application/octet-stream ');
Header (' content-disposition:attachment; filename= "Example.zip");
Header (' content-transfer-encoding:binary ');
Load the file to send:
ReadFile (' Example.zip ');
//Disable caching for the current document
Header (' Cache-control:no-cache, No-store, max-age=0, Must-revalidate ');
Header (' Expires:mon, June 1997 05:00:00 GMT '); Date in the past
Header (' 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 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 files
Header (' Content-type:application/x-shockw**e-flash '); Flash Animation
//Show login dialog box
Header (' http/1.1 401 Unauthorized ');
Header (' Www-authenticate:basic realm= "top Secret");
print ' Text that'll be displayed if the user hits cancel or ';
print ' enters wrong login data ';