php header() 常用content-type

  
header('Location: http://www.51ask.org/');  //header跳转到一个新地址  

header( 'Content-Type:text/html;charset=utf-8 '); //定义编码

header('Content-Type: text/html; charset=iso-8859-1'); //设置内容类型:

header('Content-Type: text/plain'); //纯文本格式

header('Content-Type: image/jpeg'); //JPG***

header('Content-Type: application/zip'); // ZIP文件

header('Content-Type: application/pdf'); // PDF文件

header('Content-Type: audio/mpeg'); // 音频文件

header('Content-Type: application/x-shockw**e-flash'); //Flash动画

header('Content-type: application/atom+xml'); //Atom

header('Content-type: text/css'); //CSS

header('Content-type: text/javascript'); //Javascript

header('Content-type: image/jpeg'); //JPEG Image

header('Content-type: application/json'); //JSON

header('Content-type: application/pdf'); //PDF

header('Content-Type: application/rss+xml; charset=ISO-8859-1'); //RSS

header('Content-type: text/plain'); //Text (Plain)

header('Content-type: text/xml'); //XML

header('HTTP/1.1 200 OK'); // ok

header('HTTP/1.1 404 Not Found'); //设置一个404头:

header('HTTP/1.1 301 Moved Permanently'); //设置地址被永久的重定向

header('Refresh: 10; url=http://www.51ask.org/'); //文件延迟转向:

header('Content-language: en'); //文档语言

header('HTTP/1.1 304 Not Modified'); //告诉浏览器文档内容没有发生改变

header('Content-Length: 512'); //设置内容长度

//设置为一个下载类型
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');

//对当前文档禁用缓存
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');

0 个评论

要回复文章请先登录注册