刚刚测试了,在php文件的最顶端加入如下代码可实现在firefox浏览器中的客户端缓存!!
<?php $time = mktime(date("H")+8,date("i"),date("s"),date("m"),date("d"),date("Y"));
header('Cache-Control: max-age=259200');
header("Expires: Fri, 31 Oct 2009 02:14:04 GMT");
header('Last-Modified: '.gmdate('D, d M Y 01:01:01',$time).' GMT');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>
<body>
aaaaaaaaaaaaaaaaaaaaaaaaaaa
</body>
</html>
上述头文件在ie中进行测试的时候发现,页面无法刷新!就是强制刷新也不可以!!!
只有把 header('Last-Modified: '.gmdate('D, d M Y 01:01:01',$time).' GMT'); 这个内容去掉,ie才正常刷新!!
切记切记!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<?php
header('Cache-Control: max-age=259200');
header("Expires: Fri, 31 Oct 2009 02:14:04 GMT");
?>
<?php $time = mktime(date("H")+8,date("i"),date("s"),date("m"),date("d"),date("Y"));
header('Cache-Control: max-age=259200');
header("Expires: Fri, 31 Oct 2009 02:14:04 GMT");
header('Last-Modified: '.gmdate('D, d M Y 01:01:01',$time).' GMT');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>
<body>
aaaaaaaaaaaaaaaaaaaaaaaaaaa
</body>
</html>
上述头文件在ie中进行测试的时候发现,页面无法刷新!就是强制刷新也不可以!!!
只有把 header('Last-Modified: '.gmdate('D, d M Y 01:01:01',$time).' GMT'); 这个内容去掉,ie才正常刷新!!
切记切记!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<?php
header('Cache-Control: max-age=259200');
header("Expires: Fri, 31 Oct 2009 02:14:04 GMT");
?>