//定义编码

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

//Atom

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

//CSS

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

//Javascript

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

//JPEG Image

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

//JSON

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

//PDF

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

//RSS

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

//Text (Plain)

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

//XML

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

// 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.jbxue.com/');

//文件延迟转向:

header('Refresh: 10; url=http://www.jbxue.com/');

print 'You will be redirected in 10 seconds';//当然,也可以使用html语法实现// <meta http-equiv="refresh" content="10;http://www.jbxue.com/ />

// override X-Powered-By: PHP:

header('X-Powered-By: PHP/4.4.0');

header('X-Powered-By: Brain/0.6b');

//文档语言

header('Content-language: en');

//告诉浏览器最后一次修改时间

$time = time() - 60; // or filemtime($fn), etc

header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');

//告诉浏览器文档内容没有发生改变

header('HTTP/1.1 304 Not Modified');

//设置内容长度

header('Content-Length: 1234');

//设置为一个下载类型

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename="example.zip"');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 pastheader('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 常用header的更多相关文章

  1. PHP 常用header头定义

    在php的开发中,我们常常需要使用到header函数头来进行做标记 header() 函数向客户端发送原始的 HTTP 报头. 常用header设置列表如下: header('HTTP/1.1 200 ...

  2. php常用header状态

    <?php //200 正常状态 header('HTTP/1.1 200 OK'); // 301 永久重定向,记得在后面要加重定向地址 Location:$url header('HTTP/ ...

  3. 常用header头

    // ok 正常访问header('HTTP/1.1 404 Not Found'); //通知浏览器 页面不存在 header('HTTP/1.1 200 OK'); //设置地址被永久的重定向 3 ...

  4. 开源的API集成测试工具 v0.1.2 - 增强体验

    Hitchhiker 是一款开源的 Restful Api 集成测试工具,你可以在轻松部署到本地,和你的team成员一起管理Api. 详细介绍请看: http://www.cnblogs.com/br ...

  5. Cross-Origin跨域问题

    为什么会跨域,要先了解浏览器的同源策略SOP(Same Orign Policy)  https://segmentfault.com/a/1190000015597029 同源: 如果两个页面的协议 ...

  6. Linux实战教学笔记43:squid代理与缓存实践(二)

    第6章 squid代理模式案例 6.1 squid传统正向代理生产使用案例 6.1.1 squid传统正向代理两种方案 (1)普通代理服务器 作为代理服务器,这是SQUID的最基本功能:通过在squi ...

  7. 详解SpringBoot应用跨域访问解决方案

    一.什么是跨域访问 说到跨域访问,必须先解释一个名词:同源策略.所谓同源策略就是在浏览器端出于安全考量,向服务端发起请求必须满足:协议相同.Host(ip)相同.端口相同的条件,否则访问将被禁止,该访 ...

  8. squid代理与缓存(下)

    squid代理与缓存(下) 6. squid代理模式案例 6.1 squid传统正向代理生产使用案例 6.1.1 squid传统正向代理两种方案 (1)普通代理服务器 作为代理服务器,这是SQUID的 ...

  9. 学习Squid(二)

    第6章 squid代理模式案例 6.1 squid传统正向代理生产使用案例 6.1.1 squid传统正向代理两种方案 (1)普通代理服务器 作为代理服务器,这是SQUID的最基本功能:通过在squi ...

随机推荐

  1. 【ACM】hdu_zs2_1003_Problem C_201308031012

    Problem C Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)Total Subm ...

  2. windows终端 进入文件夹

    盘符: 例如想进入D盘 d: cd 进入到当前盘某个目录.cd \ 进入当前盘根目录cd \windows 进入到当前盘Windows目录cd.. 退出到上一级目录 注:进入含有特殊字符目录时需要加引 ...

  3. PHP扩展开发--实验成功

    原文:http://kimi.it/496.html http://blog.csdn.net/u011957758/article/details/72234075 ---------------- ...

  4. configure: error: XML configuration could not be found

    运行: ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm 之后出现 Running FastCGI Process M ...

  5. C# List数据批量更新

    针对单条数据一般都是update语句直接更新 例如:update UserTable set UserName='小名'   where userid=xxx 但是如果是针对List数据组进行更新的话 ...

  6. gephi——怎样上传节点表格而且为节点设定颜色类型

    使用gephi过程中出现两个问题: 一.节点编号不安给定的属性(Nodes)编号,而是莫名其妙地从1w+開始 解决:数据列名中需包括 id.则默觉得节点编号 二.怎样在上传的数据中指定节点颜色 须要一 ...

  7. Swift_ios_二进制,十进制,十六进制之间的转换

    这里所说的转换,并不是Swift中字面量之间的转换.如果是字面量之间的转换,ios系统中已经自动帮我们转换了. 例如let number1:Int = 8let number2:Int = 0b100 ...

  8. (转)android res文件夹里面的drawable(ldpi、mdpi、hdpi、xhdpi、xxhdpi)

    android res文件夹里面的drawable(ldpi.mdpi.hdpi.xhdpi.xxhdpi) (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),F ...

  9. Amazon宣布将MXNet作为AWS的深度学习框架——貌似性能比tf高啊

    Amazon公司的Werner Vogels于上周宣布Amazon深度学习框架将会正式选用MXNet,并且AWS将会通过增加源代码贡献.改进文档以及支持来自其它框架的可视化.开发以及迁移工具,为实现M ...

  10. html5之文件操作

    用来把文件读入内存,并且读取文件中的数据.FileReader接口提供了一个异步API,使用该API可以在浏览器主线程中异步访问文件系统,读取文件中的数据.到目前文职,只有FF3.6+和Chrome6 ...