Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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 缓存同一文件时浏览器的不同行为_Php_Caching - Fatal编程技术网

Php 缓存同一文件时浏览器的不同行为

Php 缓存同一文件时浏览器的不同行为,php,caching,Php,Caching,我正在尝试实现mod\u disk\u缓存。我编写了一个php代码,如下面的教程示例所示 我在候机楼开了下列枪 a2enmod cache a2enmod disk_cache /etc/init.d/apache2 force-reload then in the php code <?php header("Cache-Control: must-revalidate, max-age=3000"); header("Vary: Accept-Encoding"); echo

我正在尝试实现
mod\u disk\u缓存
。我编写了一个php代码,如下面的教程示例所示

我在候机楼开了下列枪

a2enmod cache
a2enmod disk_cache

/etc/init.d/apache2 force-reload

then in the php code 

<?php
header("Cache-Control: must-revalidate, max-age=3000");
header("Vary: Accept-Encoding");
echo time()."<br>";
?>
a2enmod缓存
a2enmod磁盘缓存
/etc/init.d/apache2强制重新加载
然后在php代码中
现在我试着用firefox运行它

在第一次执行中,我得到了以下时间戳

1308643975

在这里,当我按refresh时,时间戳会更改(因为文件是从服务器重新加载的) 并且在再次单击链接时保持不变(因为文件是从缓存中检索的)

现在我正在用
IExplorer
尝试同样的方法

根据我的理解,时间戳应该与文件的后续请求相同,该请求将仅从缓存中检索。但我得到了一个不同的时间戳


谁能解释一下原因吗?当浏览器不同时,为什么会给出不同的时间戳?

尝试添加更多的标题:“Expires”、“Pragma”,这是正在执行的php代码