纵易网络 网站建设 纵易网络 网站建设
 400-700-0251  021-69106465
当前位置:首页 >> 技术文档 >> 网页编程 >> PHP编程 >> 浏览文章
http报头php中使用header函数的http头设置

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

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

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

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

//文件延迟转向:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';

//当然,也可以使用html语法实现
// header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile('example.zip');

// 对当前文档禁用缓存
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');

//设置内容类型:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
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('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';

关键词: php程序开发,php教程   发表时间:2010年01月04日 浏览次数:
上一篇:工作记录超市商品为什么要盘点?盘点有何好处?
下一篇:http报头http所有报头总结
技术分类 TECHNOLOGY
热门技术 TECHNOLOGY
推荐技术 TECHNOLOGY
400-700-0250
021-69106465
你好,我是纵易客服小白杨!  你好,我是纵易客服周小姐
你好,我是纵易客服闫先生  你好,我是纵易客服王小姐
你好,我是纵易技术袁先生  你好,我是纵易技术袁先生
msn  msn
msn  msn
合作伙伴 COOPRATOR (诚征PR>=5的链接;PR <=4 的网站移到内页)
上海礼品网网站优化广州SEO关键词优化您的位置您的位置您的位置您的位置
首页 | 特效展示 | 技术文档 | 联系我们 | 付款方式 | 隐私声明 | 网站地图 | RSS | 下载中心 | 帮助中心 | 广告合作  | 员工博客
Copyright 2006-2009 上海纵易网络科技有限公司 All Rights Reserved , 备案号:沪ICP备06044373号
上海网站改版 上海网站建设 上海网站制作 上海网页设计 上海网络公司
官方永久网址:www.1861web.com, 上海网站建设公司  上海网络公司 官方博客: blog.1861web.com, 官方交流论坛: bbs.1861web.com 电话:+86-021-69106465 传真:+86-021-69106465-807 E-mail:info@1861web.com
地址: 上海市曹安路1775号411室 邮编:201820