PHP常用的header头部定义
<?php
header('HTTP/1.1 200 OK'); // ok 正常访问
header('HTTP/1.1 404 Not Found'); //通知浏览器 页面不存在
header('HTTP/1.1 301 Moved Permanently'); //设置地址被永久的重定向 301
header('Location: http://www.php20.cn/'); //跳转到一个新的地址
header('Refresh: 10; url=http://www.php20.cn/'); //延迟转向 也就是隔几秒跳转
header('X-Powered-By: PHP/6.0.0'); //修改 X-Powered-By信息
header('Content-language: zh'); //文档语言
header('Content-Length: 1000'); //设置内容长度
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); //告诉浏览器最后一次修改时间
header('HTTP/1.1 304 Not Modified'); //告诉浏览器文档内容没有发生改变 /**
*声明一个需要下载的xls文件
*/
header('Content-Disposition: attachment; filename=ithhc.xlsx');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Length: '.filesize('./test.xls'));
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate');
header('Pragma: public');
readfile('./test.xls');
/**
*内容类型
*/
header('Content-Type: text/html; charset=utf-8'); //网页编码
header('Content-Type: text/plain'); //纯文本格式
header('Content-type: text/javascript'); //js文件
header('Content-type: application/json'); //json
header('Content-type: application/pdf'); //pdf
header('Content-type: text/xml'); //xml
header('Content-Type: application/x-shockw**e-flash'); //Flash动画
header('Content-Type: image/jpeg'); //JPG、JPEG
header('Content-Type: application/zip'); // ZIP文件
header('Content-Type: application/pdf'); // PDF文件
header('Content-Type: audio/mpeg'); // 音频文件
header('Content-type: text/css'); //css文件 /**
*声明一个下载的zip文件
*/
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="ITblog.zip"');
readfile('test.zip'); /**
*对当前文档禁用缓存
*/ header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); /**
*显示一个需要验证的登陆对话框
*/
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"'); ?>
PHP常用的header头部定义的更多相关文章
- PHP 常用的header头部定义汇总
<?phpheader('HTTP/1.1 200 OK'); // ok 正常访问header('HTTP/1.1 404 Not Found'); //通知浏览器 页面不存在header(' ...
- 【转载】PHP 常用的header头部定义汇总
header() 函数向客户端发送原始的 HTTP 报头. 认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数(在 PHP 4 以及更高的版本中,您可以使用输出缓存来解决此 ...
- PHP 常用的header头部定义汇总
http://www.jb51.net/article/68159.htm
- 几种常用的JS类定义方法
几种常用的JS类定义方法 // 方法1 对象直接量var obj1 = { v1 : "", get_v1 : function() { return ...
- Android RecyclerView添加Header头部
Android RecyclerView添加Header头部 Android RecyclerView不像以前的ListView那样直接添加头部,如果要给RecyclerView增加头部,则需要 ...
- [HIS] HIT行业常用名词及缩写定义
[HIS] HIT行业常用名词及缩写定义 1. EHR 居民个人电子健康记录 2. MPI 居民个人主索引 3. HIS 医院管理信息系统 4. CIS 医院临床信息系统 5. P ...
- php常用的header头
<?php /** * php常用的header头设置... */ header('HTTP/1.1 200 OK'); // ok 正常访问 header('HTTP/1.1 404 Not ...
- nginx 获取自定义header头部信息
为了排查线上的bug,需要在nginx的日志中,打印客户端上传上来的header头部信息,同时头部信息是自定义的.在尝试多重方案后,找到解决方法: log_format dm '"$remo ...
- PHP 常用header头定义
在php的开发中,我们常常需要使用到header函数头来进行做标记 header() 函数向客户端发送原始的 HTTP 报头. 常用header设置列表如下: header('HTTP/1.1 200 ...
随机推荐
- VUE--插值的操作
一.vue常见的指令 v-once:保留第一次渲染结果 v-html :把html代码解析,只显示内容 v-pre :原样输出 v-cloak :解决文本闪烁问题 v-text :显示文本 二.v-b ...
- Map集合(双列集合)
Map集合(双列集合)Map集合是键值对集合. 它的元素是由两个值组成的,元素的格式是:key=value. Map集合形式:{key1=value1 , key2=value2 , key3=val ...
- TensorFlow2.0(7):激活函数
.caret, .dropup > .btn > .caret { border-top-color: #000 !important; } .label { border: 1px so ...
- [Mathematics][MIT 18.02]Detailed discussions about 2-D and 3-D integral and their connections
Since it is just a sort of discussion, I will just give the formula and condition without proving th ...
- Vtable内存布局分析
vtale 内存布局分析 虚函数表指针与虚函数表布局 考虑如下的 class: class A { public: int a; virtual void f1() {} virtual void f ...
- 初识域渗透利器Empire
Empire 是一款类似Metasploit 的渗透测试框架,基于python 编写,Empire是一个纯粹的PowerShell 后开发代理,建立在密码安全通信和灵活的架构上.Empire 实现了无 ...
- PHP pa和ma
<?php class Mouse { private $color; public $sex; public function __construct($role){ switch($role ...
- [POJ3107] Godfather - 暴力枚举(树的重心)
Godfather Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8728 Accepted: 3064 Descrip ...
- Cocos2d-x 学习笔记(15.1) EventDispatcher
EventDispatcher对监听器进行管理,围绕着监听器工作.可以添加.删除.暂停/恢复监听器.分发事件到监听器. 1. 一些成员 /** 把ListenerID和同ID监听器的容器对应 */ s ...
- MFC::使用mysql
下载mysql-installer-community-5.7.16.0.msi,安装 mysql server即可. 创建工程包含头文件 #include "winsock.h" ...