`

PHP 修改HTTP头 --Modify HTTP Headers

    博客分类:
  • PHP
 
阅读更多
Modify HTTP Headers

// See related links for more status codes
 
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
 
// Page was not found:
header('HTTP/1.1 404 Not Found');
 
// Access forbidden:
header('HTTP/1.1 403 Forbidden');
 
// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
header('HTTP/1.1 301 Moved Permanently');
 
// Server error
header('HTTP/1.1 500 Internal Server Error');
 
// Redirect to a new location:
header('Location: http://www.example.org/');
 
// Redriect with a delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
 
// you can also use the HTML syntax:
// <meta http-equiv="refresh" content="10;http://www.example.org/ />
 
// override X-Powered-By value
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 past
header('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';
分享到:
评论

相关推荐

    modify-http-headers Chrome插件-20190820

    modify-http-headers Chrome插件, 测试可用,包含插件安装文档

    modify_headers-0.7.1.1-fx.xpi

    File modifyHeaders = new File&#40;pluginPath&#41;; profile.addExtension(modifyHeaders); profile.setPreference("modifyheaders.headers.count", 1); profile.setPreference("modifyheaders.headers.action0", ...

    simple-modify-headers-crx插件

    简单的修改头 该扩展基于规则表重写标头。 可能:添加,修改或删除HTTP(S)请求或响应的标头字段以文件(json格式)导出配置从文件中导入配置选择要对其应用修改的url为了起作用,以下扩展名需要权限:存储:需要...

    修改-HTTP报头「Modify-http-headers」-crx插件

    这个扩展可以编辑http头。 专用修改http request headers chrome 支持语言:English

    modify_headers-0.7.0.2-fx+sm.xpi

    modify_headers-0.7.0.2-fx+sm.xpi

    前端开源库-less-modify-var-loader

    前端开源库-less-modify-var-loader修改var加载器更少,webpack加载器更好地替换更少的变量

    modify_headers.zip

    一款谷歌浏览器插件,辅助http头注入的检测,欢迎喜欢的朋友下载

    SimpleModifyHeaders:Firefox和chrome扩展程序,用于修改标题

    它支持Modifyheaders插件的格式 规则表 规则表包含带有以下参数的行: 行动:添加,修改或删除标题字段 标头字段名称 标头字段值 评论:一条评论 适用于:如果修改适用于请求标头,则为“请求”;如果修改适用于...

    HTTP Headers-crx插件

    查看浏览器中的所有HTTP / HTTPS流量。 从浏览器监控所有HTTP / HTTPS流量。 HTTP标头记录Google Chrome和Internet之间的所有HTTP流量。 从“设置”对话框中选择要捕获的资源类型。 此扩展向您展示了所有标题,因为...

    Modify Header Value (HTTP Headers)-crx插件

    修改标题值(HTTP标头)是可以添加,修改或删除HTTP-Request-Header的扩展名对于所需网站或URL上的所有请求。如果您是App Developer,网站设计师,或者您想在网站上的请求中测试特定标题,则此插件非常有用。主要...

    ModHeader - Modify HTTP headers Chrome插件 离线安装包

    ModHeader 是一个非常好用的Chrome浏览器插件,可以用于在浏览器发出的所有请求中拦截并添加自定义的header. 如果有条件的可以直接访问ModHeader-Chrome插件应用商店安装 由于国内网络默认不支持访问Chrome应用...

    Network-Reinstall-System-Modify-Stable_Version-3.1.1.zip

    Network-Reinstall-System-Modify 一键重装服务器系统

    chrome插件修改请求头

    修改chrome的请求头。 Header Editor是一款管理浏览器请求的Chrome扩展,包括修改请求头、修改响应头、重定向请求、取消请求。  您可以从Redirector导入规则  规则说明:  1、匹配类型  规则会应用到满足相应...

    modify-header-value-http-0.1.3.crx

    Modify Header Value (HTTP Headers) 这个插件的主要作用是对Chrome的HTTP request headers进行添加、修改和过滤等操作。当我们访问网站的时候,某些网站服务器会对访问网站的浏览器Header信息进行判断,然后决定用...

    read-file--modify.zip_Linux 文件监测

    文件读写,定时监测文件是否被更改,若更改,程序重启

    setcookie中Cannot modify header information-headers already sent by错误的解决方法详解

    运行有警告Warning: Cannot modify header information – headers already sent by  下面是别人建议 方法一:在PHP里Cookie的使用是有一些限制的。1、使用setcookie必须在&lt;html&gt;标签之前2、使用setcookie...

Global site tag (gtag.js) - Google Analytics