php header头信息 举例
php header头信息的例子。
<?php // 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.example.org/');
// redrict with delay: header('Refresh: 10; url=http://www.example.org/'); 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函数的用法举例详解
php 文件下载类(header头信息的应用实例)
php header 使用详解
php header函数 文件下载时直接提示保存的代码
php 文件头部(header)信息详解
PHP中HEADER头消息详解
php header函数使用要点
php header头信息 举例的更多相关文章
- curl get请求添加header头信息
function get($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CU ...
- HTTP header头信息
HTTP(HyperTextTransferProtocol)即超文本传输协议,目前网页传输的的通用协议.HTTP协议采用了请求/响应模型,浏览器或其他客户端发出请求,服务器给与响应.就整个网络资源传 ...
- nginx反向代理导致请求header头信息丢失
背景:前端与后端调试接口,后端拿不到前段发过去的请求头信息,导致接口不通.(但是在本地是可以拿到的) 原因:nginx做了反向代理,没有请求时候加头信息的配置 报错如下: 解决方法: 方法一:NGIN ...
- Nginx 操作响应头信息的实现
前置条件:需要编译 ngx_http_headers_module 模块,才支持 header 头信息操作 add_header 意思为将自定义的头信息的添加到响应头,指令为 add_header n ...
- 提取header头进行模块化处理
在进行爬取网上东西的时候一般网站都做了UA的过滤,解决办法就是在代码中加入. 所以才有了本篇提取header头信息单独写成一个模块或者说是函数/类的想法,直接上示例 1.把UA头信息在浏览器中复制出来 ...
- PHP中header头设置Cookie与内置setCookie的区别
首先声明,浏览的Cookie操作都是通过HTTP Header(俗称“Http头”) 来实现.所有的服务器与客户端之间Cookie数据传输都是通过Http请求头来操作. PHP中setCookie(函 ...
- Tomcat 中响应头信息(Http Response Header) Content-Length 和 Transfer-Encoding
户端(PC浏览器或者手机浏览器)在接受到Tomcat的响应的时候,头信息通常都会带上Content-Length ,一般情况下客户端会在接受完Content-Length长度的数据之后才会开始解析.而 ...
- HTTP 响应头信息(Http Response Header) Content-Length 和 Transfer-Encoding
Tomcat 中响应头信息(Http Response Header) Content-Length 和 Transfer-Encoding 客户端(PC浏览器或者手机浏览器)在接受到Tomcat的响 ...
- java中如何设置HTTP协议的头信息(header)
首先,我们先看一下http的头信息到底是什么:HTTP(HyperTextTransferProtocol) 即超文本传输协议,目前网页传输的的通用协议.HTTP协议采用了请求/响应模型,浏览器或其他 ...
随机推荐
- Bitmap 多语言实现及应用
http://blog.studygolang.com/2014/09/bitmap_multi_language/
- BootStrap2学习日记12---注册表单
<form method="" action="" class="form-horizontal"> <frameset& ...
- 基于PHP的对接电子面单接口平台案例
电子面单接口目前有三种对接方式,快递电子面单接口.菜鸟电子面单接口和快递鸟电子面单接口.这三种接口各有特点. 一.电子面单接口定义 1. 快递电子面单接口:快递公司自己开发的电子面单服务, 商家使用必 ...
- 杂乱无章之Oracle(一)
1. 设置共享池大小 SQL>ALTER SYSTEM SET SHARED_POOL_SIZE=32M; 2. 数据库高速缓冲区(database buffer cache):SQL ...
- [未完成]关于xml文件的解析
附录一个比较特别的xml文件. MultiNamespaceInlineRequest.xml <?xml version="1.0" encoding="ISO- ...
- hdu 2852 树状数组
思路:加一个数e就用update(e,1).删除元素e就用update(e,-1).找比a大的第k大的元素就用二分查找. #include<iostream> #include<cs ...
- poj 3692 二分图最大匹配
思路: 如果我们将认识的建边,求最大独立集就是互相不认识的人数.那么我们反过来,将不认识的建图,求最大独立集就是互相认识的人数. #include<cstdio> #include< ...
- hdu 1518 深搜
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #i ...
- Linux 解压/压缩操作命令
.tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gun ...
- HttpClient(4.3.5) - HTTP Entity
HTTP entity HTTP messages can carry a content entity associated with the request or response. Entiti ...