Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP/Apache2中删除我的头是什么?_Php_Apache_Http - Fatal编程技术网

在PHP/Apache2中删除我的头是什么?

在PHP/Apache2中删除我的头是什么?,php,apache,http,Php,Apache,Http,我使用PHP5.3和Apache 2.0提供一个脚本,该脚本向输出中添加了许多头文件: header('HTTP/1.1 200 OK'); header("Content-Type: application/json"); header("Last-Modified: $lastmode"); // $lastmod = Tue, 01 Mar 2011 14:56:22 +0000 header("Etag: $etag"); // Etag = 5da02274fcad09a55f4d7

我使用PHP5.3和Apache 2.0提供一个脚本,该脚本向输出中添加了许多头文件:

header('HTTP/1.1 200 OK'); 
header("Content-Type: application/json");
header("Last-Modified: $lastmode"); // $lastmod = Tue, 01 Mar 2011 14:56:22 +0000
header("Etag: $etag"); // Etag = 5da02274fcad09a55f4d74467f66a864
现在,除了上次修改的
Etag
之外,所有的标题都通过了。在我的httpd.conf中,我有以下内容:

Header unset Cache-Control
Header unset Pragma
但我的回答是:

HTTP/1.1 200 OK
Date: Tue, 01 Mar 2011 16:49:10 GMT
Server: Apache/2.2.14 (EL) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5
Keep-Alive: timeout=15, max=8000
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json
Expires: 0
Cache-Control: no-cache
我的
上次修改的
Etag
标题不见了,我们有
缓存控制
过期

我还应该提到,我已经禁用了
mod_expires
,但没有任何效果。我在这一点上拔出我的头发,因为无论我做什么,标题根本不存在。什么可能导致它们被移除

谢谢, J

更新:似乎Apache在PHP关闭后添加了额外的头,我认为它也在删除我上面设置的头。在PHP中注册关机函数并调用
apache\u response\u headers
显示:

Pragma=
Expires=  
Etag=5da02274fcad09a55f4d74467f66a864
Last-Modified=Tue, 01 Mar 2011 14:56:22 +0000
Keep-Alive=timeout=15, max=8000
Connection=Keep-Alive
Transfer-Encoding=chunked
Content-Type=application/json

为了回答我自己的问题,我用来调试的工具似乎让我感到悲伤。首先是mod_expires模块导致了问题,但是删除它没有效果的原因是我用来调试问题的代理(Charles)似乎修改了头。一旦查尔斯被带出循环,我的头球就在那里

什么值是
$lastmode
$etag
?对不起,我已经更新了问题以显示值。