You can send header information through the header function in PHP, and you can set the Content-type of the file, and then sort out the content-type values for some common file types.
Date 2015-06-22//Definition Code 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 Header: 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 '); Tells the browser last modified $time = time ()-60; or Filemtime ($FN), etc header (' last-modified: '. Gmdate (' d, D M Y h:i:s ', $time). '
GMT ');
Tells the browser that the contents of the document have not changed header (' http/1.1 304 not Modified ');
Set the 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 ');
Disables the cache header for the current document (' 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 file header (' Content-type:application/x-shockw**e-flash ');
Flash animation//Display Login Dialog 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 ';
The above is the entire contents of this article, I hope you can enjoy.