作者:zccst
与别人一样,现在才知道php的header()函数很强
下面列表中的先后顺序:
文档类(doc,pdf)
音频类(mp3,wav)
图片类(jpg,jpeg,png,gif,bmp)
Web类(html,css,xml等)
其中,text很重要,主要用在response中。
视频类(video/mpeg)
一、Content-type列表
$mimetypes = array(
//自己加几个
'rss'=>'application/xml',
//下面是网上的
'ez' => 'application/andrew-inset',
'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'application/msword',
'bin' => 'application/octet-stream',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => 'application/octet-stream',
'class' => 'application/octet-stream',
'so' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => 'application/pdf', //了解
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint', //了解
'wbxml' => 'application/vnd.wap.wbxml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'bcpio' => 'application/x-bcpio',
'vcd' => 'application/x-cdlink',
'pgn' => 'application/x-chess-pgn',
'cpio' => 'application/x-cpio',
'csh' => 'application/x-csh',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'spl' => 'application/x-futuresplash',
'gtar' => 'application/x-gtar',
'hdf' => 'application/x-hdf',
'js' => 'application/x-javascript', //了解
'skp' => 'application/x-koan',
'skd' => 'application/x-koan',
'skt' => 'application/x-koan',
'skm' => 'application/x-koan',
'latex' => 'application/x-latex',
'nc' => 'application/x-netcdf',
'cdf' => 'application/x-netcdf',
'sh' => 'application/x-sh',
'shar' => 'application/x-shar',
'swf' => 'application/x-shockwave-flash', //了解
'sit' => 'application/x-stuffit',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc',
'tar' => 'application/x-tar', //了解
'tcl' => 'application/x-tcl',
'tex' => 'application/x-tex',
'texinfo' => 'application/x-texinfo',
'texi' => 'application/x-texinfo',
't' => 'application/x-troff',
'tr' => 'application/x-troff',
'roff' => 'application/x-troff',
'man' => 'application/x-troff-man',
'me' => 'application/x-troff-me',
'ms' => 'application/x-troff-ms',
'ustar' => 'application/x-ustar',
'src' => 'application/x-wais-source',
'xhtml' => 'application/xhtml+xml', //了解
'xht' => 'application/xhtml+xml',
'zip' => 'application/zip', //了解
'au' => 'audio/basic',
'snd' => 'audio/basic',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'kar' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg', //了解
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'm3u' => 'audio/x-mpegurl',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'wav' => 'audio/x-wav', //了解
'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-xyz',
'bmp' => 'image/bmp', //了解
'gif' => 'image/gif', //了解
'ief' => 'image/ief',
'jpeg' => 'image/jpeg', //了解
'jpg' => 'image/jpeg', //了解
'jpe' => 'image/jpeg',
'png' => 'image/png', //了解
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'djvu' => 'image/vnd.djvu',
'djv' => 'image/vnd.djvu',
'wbmp' => 'image/vnd.wap.wbmp',
'ras' => 'image/x-cmu-raster',
'pnm' => 'image/x-portable-anymap',
'pbm' => 'image/x-portable-bitmap',
'pgm' => 'image/x-portable-graymap',
'ppm' => 'image/x-portable-pixmap',
'rgb' => 'image/x-rgb',
'xbm' => 'image/x-xbitmap',
'xpm' => 'image/x-xpixmap',
'xwd' => 'image/x-xwindowdump',
'igs' => 'model/iges',
'iges' => 'model/iges',
'msh' => 'model/mesh',
'mesh' => 'model/mesh',
'silo' => 'model/mesh',
'wrl' => 'model/vrml',
'vrml' => 'model/vrml',
'css' => 'text/css', //了解
'html' => 'text/html', //了解
'htm' => 'text/html',
'asc' => 'text/plain',
'txt' => 'text/plain', //了解
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'sgml' => 'text/sgml',
'sgm' => 'text/sgml',
'tsv' => 'text/tab-separated-values',
'wml' => 'text/vnd.wap.wml',
'wmls' => 'text/vnd.wap.wmlscript',
'etx' => 'text/x-setext',
'xsl' => 'text/xml',
'xml' => 'text/xml',
'mpeg' => 'video/mpeg', //了解
'mpg' => 'video/mpeg', //了解
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'mxu' => 'video/vnd.mpegurl',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'ice' => 'x-conference/x-cooltalk',
);
二、Content-type分析整理
文档:
application/msword=>doc
application/vnd.ms-powerpoint=>ppt
application/vnd.ms-excel=>xls
application/pdf=>pdf
application/zip=>zip
application/x-tar=>tar
音频:
audio/x-wav=>wav
audio/mpeg=>mp3,mp2,mpga
audio/midi=>mid,midi,kar
图片:
image/jpeg=>jpeg,jpg,jpe,png
image/gif=>gif
image/bmp=>bmp
Web:
text/html=>html,htm
text/css=>css
text/plain=>text//重要
视频:
video/mpeg =>mpeg,mpg,mpe
video/quictime=>qt,mov
video/x-msvideo=>avi
video/x-sgi-movie=>movie
分享到:
相关推荐
Content-type 的说明,php header 重视用的参数说明
主要介绍了php中header设置常见文件类型的content-type的相关资料,需要的朋友可以参考下
Content-Type(内容类型),一般是指网页中存在的 Content-Type,用于定义网络文件的类型和网页的编码,决定浏览器将以什么形式、什么编码读取这个文件,这就是经常看到一些 PHP 网页点击的结果却是下载一个文件或...
php $mimetypes = array( ‘ez’ => ‘application/andrew-inset’, ‘hqx’ => ‘application/mac-binhex40’, ‘cpt’ => ‘application/mac-compactpro’, ‘doc’ => ‘application/msword’, ‘bin’ => ...
php-phpdocumentor-type-resolver1-1.3.0-1.el7.remi.noarch.rpm
本文章详细的介绍了关于php header中Content-disposition用法详细,有需要了解header用法的朋友可参考一下
这里php模拟post提交json数据操作的关键是在头部设置Content-Type <?php header(Content-type:application/json;charset=utf-8); $url=http://192.168.10.234:8080/uc/login/loginid; $param=array( //注册字段...
可以与在HTTP请求中需要布尔值或数组的攻击(PHP Type Juggling,NoSQL Injection,Prototype Pollution等)结合使用。 有趣的结果 WAF绕过 基本思想 HTTP请求 应用 WAF 结果 内容类型:application / x-...
中间件根据主体大小将Content-Length标头注入响应中。 要求 PHP> = 7.2 安装 该软件包可以通过Composer作为安装和自动加载。 composer require middlewares/content-length 例子 $ dispatcher = new Dispatcher (...
修改Content-Type值为:image/png,仍旧上传失败。 任意文件上传 3、测试如何绕过过滤 于是猜测可能是文件头过滤,由于先前能正常上传png文件,于是用HxD打开一个png文件,在文件尾写入一段木马,如右图所示。 任意...
如果欲使用gb2312编码,那么php要输出头:header(“Content-Type: text/html; charset=gb2312″),静态页面添加<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>,所有文件的编码...
第一种方法: $filename='\u6587\u4ef6\u540d\u79f0'... header('Content-Type: application/vnd.ms-excel;charset=utf-8'); $name = $title.".xls"; header('Content-Disposition: attachment;filename='.$name.'')
PHP实例开发源码—Typesetter CMS 内容管理系统 php版.zip PHP实例开发源码—Typesetter CMS 内容管理系统 php版.zip PHP实例开发源码—Typesetter CMS 内容管理系统 php版.zip
http://blog.changyy.org/2009/11/php-motion-jpeg-mjpegmjpg-http-streaming.html index.html: <img src="mjpeg.php"> mjpeg.php <?php //https://github.com/donatj/mjpeg-php //...
meta http-equiv=’Content-Type’ content=’text/html; charset=utf-8′ /> 顺序不能错,一定要在 显示的标题有可能是乱码! 2.html文件编码问题: 点击编辑器的菜单:“文件”->“另存为”,可以看到当前文件的...
CollectionType是一个库,为Collection和Map提供了它们的子类型,这些子类型正在检查PHP的数据集类型。 要求 PHP 5.5.0或更高版本 安装 CollectionType正式仅支持通过Composer进行安装。 有关Composer文档,请参阅 ...
刚开始一直获取不到前端传过来的Post的值 一番分析后 发现 通过php 命令新建的控制器默认少引用 就是上图圈起来的这个 引入就问题解决了 当然 前提是路由要配置正确 路由配置成Post或者any的时候才能获取到Post的值 ...
内容安全策略构建器 从JSON配置文件或以编程方式轻松地将Content-Security-Policy标头集成到您的Web应用程序中。 CSP Builder由创建,是我们鼓励更好的实践的工作的一部分。 也请查看我们的其他。 还有一个使用此库...