Content-type
This header contains the "Mime-type" of the document. The navigator will determine how the document is parsed based on this parameter. For example, an HTML page (or a PHP page with HTML output) would return something like this:
content-type:text/html; Charset=utf-8
' Text ' is the document type, ' HTML ' is the type of text. This header also includes more information, such as CharSet.
If it is a picture, this response will be sent:
Content-type:image/gif
The Mime-type can be used by the navigator to decide whether to open the document using an external program or its own extension. The following example drops the call to Adobe Reader:
Content-type:application/pdf
Directly loaded, Apache will usually automatically determine the mime-type of the document and add the appropriate information to the header. And most of the browser has a degree of fault tolerance, it will automatically detect Mime-type in case the header is not provided or the information is provided incorrectly.
You can find a list of commonly used mime-type here.
In PHP you can detect the Ime-type of a file by Finfo_file ().
Content-disposition
This header tells the browser to open a file download window instead of trying to parse the content of the response. For example:
Content-disposition:attachment; Filename= "Download.zip"
He causes the dialog box to appear in the browser:
Download dialog box
Note that the Content-type header information that is appropriate for it will also be sent
Content-type:application/zip
Content-disposition:attachment; Filename= "Download.zip"
You can change the HTML headers:
Content-type:application/zip
Content-disposition:attachment; Filename= "Download.mp4"
This will not play, directly downloaded
Refer to the following:
Content-type
This header contains the "Mime-type" of the document. The navigator will determine how the document is parsed based on this parameter. For example, an HTML page (or a PHP page with HTML output) would return something like this:
content-type:text/html; Charset=utf-8
' Text ' is the document type, ' HTML ' is the type of text. This header also includes more information, such as CharSet.
If it is a picture, this response will be sent:
Content-type:image/gif
The Mime-type can be used by the navigator to decide whether to open the document using an external program or its own extension. The following example drops the call to Adobe Reader:
Content-type:application/pdf
Directly loaded, Apache will usually automatically determine the mime-type of the document and add the appropriate information to the header. And most of the browser has a degree of fault tolerance, it will automatically detect Mime-type in case the header is not provided or the information is provided incorrectly.
You can find a list of commonly used mime-type here.
In PHP you can detect the Ime-type of a file by Finfo_file ().
Content-disposition
This header tells the browser to open a file download window instead of trying to parse the content of the response. For example:
Content-disposition:attachment; Filename= "Download.zip"
Reference Source: https://www.cnblogs.com/A-Song/archive/2012/01/26/2329715.html
Background server to the front page video, how can download, not directly play