HTTP content-type
Content-Type(内容类型),一般是指网页中存在的 Content-Type,用于定义网络文件的类型和网页的编码,决定浏览器将以什么形式、什么编码读取这个文件,这就是经常看到一些 PHP 网页点击的结果却是下载一个文件或一张图片的原因。
Content-Type 标头告诉客户端实际返回的内容的内容类型。
语法格式:
Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something
常见的媒体格式类型如下:
text/html : HTML格式
text/plain :纯文本格式
text/xml : XML格式
image/gif :gif图片格式
image/jpeg :jpg图片格式
image/png:png图片格式
以application开头的媒体格式类型:
application/xhtml+xml :XHTML格式
application/xml: XML数据格式
application/atom+xml :Atom XML聚合格式
application/json: JSON数据格式
application/pdf:pdf格式
application/msword : Word文档格式
application/octet-stream : 二进制流数据(如常见的文件下载)
application/x-www-form-urlencoded : <form encType=””>中默认的encType,form表单数据被编码为key/value格式发送到服务器(表单默认的提交数据的格式)
另外一种常见的媒体格式是上传文件之时使用的:
multipart/form-data : 需要在表单中进行文件上传时,就需要使用该格式
HTTP content-type 对照表
文件扩展名
Content-Type(Mime-Type)
文件扩展名
Content-Type(Mime-Type)
.*( 二进制流,不知道下载文件类型)
application/octet-stream
image/tiff
application/x-001
application/x-301
text/h323
application/x-906
drawing/907
application/x-a11
audio/x-mei-aac
application/postscript
audio/aiff
.aifc
audio/aiff
.aiff
audio/aiff
application/x-anv
text/asa
video/x-ms-asf
text/asp
video/x-ms-asf
audio/basic
video/avi
application/vnd.adobe.workflow
text/xml
application/x-bmp
application/x-bot
application/x-c4t
application/x-c90
application/x-cals
application/vnd.ms-pki.seccat
application/x-netcdf
application/x-cdr
application/x-cel
application/x-x509-ca-cert
application/x-g4
application/x-cgm
application/x-cit
.class
java/*
text/xml
application/x-cmp
application/x-cmx
application/x-cot
application/pkix-crl
application/x-x509-ca-cert
application/x-csi
text/css
application/x-cut
application/x-dbf
application/x-dbm
application/x-dbx
text/xml
application/x-dcx
application/x-x509-ca-cert
application/x-dgn
application/x-dib
application/x-msdownload
application/msword
application/msword
application/x-drw
text/xml
Model/vnd.dwf
application/x-dwf
application/x-dwg
application/x-dxb
application/x-dxf
application/vnd.adobe.edn
application/x-emf
message/rfc822
text/xml
application/x-epi
application/x-ps
application/postscript
application/x-ebx
application/x-msdownload
image/fax
application/vnd.fdf
application/fractals
text/xml
application/x-frm
application/x-g4
application/x-gbr
application/x-
image/gif
application/x-gl2
application/x-gp4
application/x-hgl
application/x-hmr
application/x-hpgl
application/x-hpl
application/mac-binhex40
application/x-hrf
application/hta
text/x-component
text/html
.html
text/html
text/webviewhtml
text/html
application/x-icb
image/x-icon
application/x-ico
application/x-iff
application/x-g4
application/x-igs
application/x-iphone
application/x-img
application/x-internet-signup
application/x-internet-signup
video/x-ivf
.java
java/*
.jfif
image/jpeg
image/jpeg
application/x-jpe
.jpeg
image/jpeg
image/jpeg
application/x-jpg
application/x-javascript
text/html
audio/x-liquid-file
application/x-laplayer-reg
.latex
application/x-latex
.lavs
audio/x-liquid-secure
application/x-lbm
.lmsff
audio/x-la-lms
application/x-javascript
application/x-ltr
video/x-mpeg
video/x-mpeg
audio/mpegurl
video/mpeg4
application/x-mac
application/x-troff-man
.math
text/xml
application/msaccess
application/x-mdb
application/x-shockwave-flash
message/rfc822
.mhtml
message/rfc822
application/x-mi
audio/mid
.midi
audio/mid
application/x-mil
text/xml
audio/x-musicnet-download
audio/x-musicnet-stream
.mocha
application/x-javascript
.movie
video/x-sgi-movie
audio/mp1
audio/mp2
.mp2v
video/mpeg
audio/mp3
video/mpeg4
video/x-mpg
application/vnd.ms-project
video/x-mpeg
.mpeg
video/mpg
video/mpg
.mpga
audio/rn-mpeg
application/vnd.ms-project
video/x-mpeg
application/vnd.ms-project
video/mpg
.mpv2
video/mpeg
application/vnd.ms-project
application/vnd.ms-project
text/xml
application/x-mmxp
image/pnetvue
application/x-nrf
message/rfc822
text/x-ms-odc
application/x-out
application/pkcs10
application/x-pkcs12
application/x-pkcs7-certificates
application/pkcs7-mime
application/pkcs7-mime
application/x-pkcs7-certreqresp
application/pkcs7-signature
application/x-pc5
application/x-pci
application/x-pcl
application/x-pcx
application/pdf
application/pdf
application/vnd.adobe.pdx
application/x-pkcs12
application/x-pgl
application/x-pic
application/vnd.ms-pki.pko
application/x-perl
text/html
audio/scpls
application/x-plt
image/png
application/x-png
application/vnd.ms-powerpoint
application/vnd.ms-powerpoint
application/x-ppm
application/vnd.ms-powerpoint
application/vnd.ms-powerpoint
application/x-ppt
application/x-pr
application/pics-rules
application/x-prn
application/x-prt
application/x-ps
application/postscript
application/x-ptn
application/vnd.ms-powerpoint
text/vnd.rn-realtext3d
audio/vnd.rn-realaudio
audio/x-pn-realaudio
application/x-ras
application/rat-file
text/xml
application/vnd.rn-recording
application/x-red
application/x-rgb
application/vnd.rn-realsystem-rjs
application/vnd.rn-realsystem-rjt
application/x-rlc
application/x-rle
application/vnd.rn-realmedia
application/vnd.adobe.rmf
audio/mid
application/vnd.rn-realsystem-rmj
audio/x-pn-realaudio
application/vnd.rn-rn_music_package
application/vnd.rn-realmedia-secure
.rmvb
application/vnd.rn-realmedia-vbr
application/vnd.rn-realsystem-rmx
application/vnd.rn-realplayer
image/vnd.rn-realpix
audio/x-pn-realaudio-plugin
.rsml
application/vnd.rn-rsml
text/vnd.rn-realtext
application/msword
application/x-rtf
video/vnd.rn-realvideo
application/x-sam
application/x-sat
application/sdp
application/x-sdw
application/x-stuffit
application/x-slb
application/x-sld
drawing/x-slk
application/smil
.smil
application/smil
application/x-smk
audio/basic
text/plain
text/plain
application/x-pkcs7-certificates
application/futuresplash
text/xml
application/streamingmedia
application/vnd.ms-pki.certstore
application/vnd.ms-pki.stl
text/html
application/x-sty
text/xml
application/x-shockwave-flash
application/x-tdf
application/x-tg4
application/x-tga
image/tiff
application/x-tif
.tiff
image/tiff
text/xml
drawing/x-top
.torrent
application/x-bittorrent
text/xml
text/plain
application/x-icq
text/iuls
text/x-vcard
application/x-vda
application/vnd.visio
text/xml
application/x-vpeg005
application/vnd.visio
application/x-vsd
application/vnd.visio
application/vnd.visio
application/x-vst
application/vnd.visio
application/vnd.visio
application/vnd.visio
.vxml
text/xml
audio/wav
audio/x-ms-wax
application/x-wb1
application/x-wb2
application/x-wb3
.wbmp
image/vnd.wap.wbmp
application/msword
application/x-wk3
application/x-wk4
application/x-wkq
application/x-wks
video/x-ms-wm
audio/x-ms-wma
application/x-ms-wmd
application/x-wmf
text/vnd.wap.wml
video/x-ms-wmv
video/x-ms-wmx
application/x-ms-wmz
application/x-wp6
application/x-wpd
application/x-wpg
application/vnd.ms-wpl
application/x-wq1
application/x-wr1
application/x-wri
application/x-wrk
application/x-ws
application/x-ws
text/scriptlet
.wsdl
text/xml
video/x-ms-wvx
application/vnd.adobe.xdp
text/xml
application/vnd.adobe.xfd
.xfdf
application/vnd.adobe.xfdf
.xhtml
text/html
application/vnd.ms-excel
application/x-xls
application/x-xlw
text/xml
audio/scpls
text/xml
text/xml
.xquery
text/xml
text/xml
text/xml
.xslt
text/xml
application/x-xwd
application/x-x_b
application/vnd.symbian.install
.sisx
application/vnd.symbian.install
application/x-x_t
application/vnd.iphone
application/vnd.android.package-archive
application/x-silverlight-app