php的header()大全
<?php
/*** Function: PHP header() examples (PHP)
** Desc: Some examples on how to use the header() function of PHPYou find a detailed tutorial at expertsrt.com (English) or at ffm.junetz.de (German).These is also a good help about caching at web-caching.com.
** Example: see below. <br/><br/><b>Tip:</b> You can use these sites to check your headers: <a href="http://web-sniffer.net/">web-sniffer.net</a>, <a href="http://www.jbxue.com/web/headers.html">jbxue.com</a> or <a href="http://www.jbxue.com/projects/analyze/">www.jbxue.com</a>.
** Author: Jonas John
*/ // fix 404 pages:
header('HTTP/1.1 200 OK'); // set 404 header:
header('HTTP/1.1 404 Not Found'); // set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently'); // redirect to a new location:
header('Location: http://www.jbxue.com/'); // redrict with delay:
header('Refresh: 10; url=http://www.jbxue.com/');
print 'You will be redirected in 10 seconds'; // you could also use the HTML syntax:// <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'); // content language (en = English)
header('Content-language: en'); // last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); // header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified'); // set content length (good for caching):
header('Content-Length: 1234'); // Headers for an download:
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');
// Disable caching of the current document:
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');
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); // plain text file
header('Content-Type: image/jpeg'); // JPG picture
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio MPEG (MP3,…) file
header('Content-Type: application/x-shockwave-flash'); // Flash animation// show sign in box
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()大全的更多相关文章
- PHP header函数使用大全
PHP header函数大全 header('Content-Type: text/html; charset=utf-8'); header('Location: http://52php.cnbl ...
- PHP header函数大全
PHP header函数大全 header('Content-Type: text/html; charset=utf-8'); header('Location: http://www.php-no ...
- PHP header() http各种状态码大全查询
PHP header()the function declaration: void header ( string string [, bool replace [, int http_respon ...
- JavaScript资源大全中文版(Awesome最新版--转载自张果老师博客)
JavaScript资源大全中文版(Awesome最新版) 目录 前端MVC 框架和库 包管理器 加载器 打包工具 测试框架 框架 断言 覆盖率 运行器 QA 工具 基于 Node 的 CMS 框 ...
- DIV+CSS规范命名大全
网页制作中规范使用DIV+CSS命名规则,可以改善优化功效特别是团队合作时候可以提供合作制作效率,具体DIV CSS命名规则CSS命名大全内容篇. 常用DIV+CSS命名大全集合,即CSS命名规则 D ...
- 实用js代码大全
实用js代码大全 //过滤数字 <input type=text onkeypress="return event.keyCode>=48&&event.keyC ...
- Node.js Web 开发框架大全《中间件篇》
这篇文章与大家分享优秀的 Node.js 中间件模块.Node 是一个服务器端 JavaScript 解释器,它将改变服务器应该如何工作的概念.它的目标是帮助程序员构建高度可伸缩的应用程序,编写能够处 ...
- Delphi Excel 操作大全
Delphi Excel 操作大全 (一) 使用动态创建的方法首先创建 Excel 对象,使用ComObj:var ExcelApp: Variant;ExcelApp := CreateOleObj ...
- Emmet语法大全手册
这是基于官方手册整理制作的,因为那个手册网页打开很慢,所以就整理在这里了.以备不时之需. Syntax Child: > nav>ul>li <nav> <ul ...
随机推荐
- ios开发--企业帐号发布
这两天需要发布一个ipa放到网上供其他人安装,需要用到企业级开发者账号. 首先详细说明一下我们的目标,我们需要发布一个ipa放到网上,所有人(包括越狱及非越狱设备)可以直接通过链接下载安装,不需要通过 ...
- Centos环境下部署游戏服务器-权限
部署Web服务器的时候,在"DocumentRoot"指向的根目录新建一个文件夹,然后将网页和资源放在这个文件夹里,通过地址http://192.168.0.100/Res/ind ...
- ITEM 2 MAC OSX 功能略强大的终端
iTerm2 iTerm 2 is a terminal emulator for Mac OS X that does amazing things. iTerm2 是一个终端模拟器,官方网站:ht ...
- struts2与struts1整合,java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
原因:我往项目的WEB-INF/lib中导入了struts2基本的包,还有struts1的core包,以及struts2-strut1-plugin的包,但是没有导入commons-loggin-1. ...
- USACO Section 3.1: Score Inflation
完全背包问题 /* ID: yingzho1 LANG: C++ TASK: inflate */ #include <iostream> #include <fstream> ...
- dojo 七 DOM dojo/dom
官方教程:Dojo DOM Functions对dom的使用,需要引用包dojo/dom.1.获取节点,dom.byIdbyId中既可以传递一个字符串,也可以传递一个节点对象 require([&qu ...
- ILog JRules 标识符 X 未定义
在定义枚举值时,属性“转译”(“translation”),定义字符串时需要双引号,相当于value值. 其属性值如果只有字符串,而没有双引号,在编译或者执行时就会报“标识符X未定义”的错误信息.
- vc 6.0 连接数据库
在mysql的文档(C:\Program Files\MySQL\MySQL Server 5.5\lib)里面找到libmysql.dll和libmysql.lib 两个文件,将他们移到 工程文件下 ...
- 单元测试之道(使用NUnit)
首先来看下面几个场景你是否熟悉 1.你正在开发一个系统,你不断地编码-编译-调试-编码-编译-调试……终于,你负责的功能模块从上到下全部完成且编译通过!你长出一口气,怀着激动而 又忐忑的心情点击界面上 ...
- HDFS的java操作方式
1.RPC 1.1 RPC (remote procedure call)远程过程调用. 远程过程指的是不是同一个进程. 1.2 RPC至少有两个过程.调用方(client),被调用方(server) ...