代理,浏览器缓存文档直到过期,缓存文档的重载不会联系服务器,尝试获取过期文档会联系服务器

设置文档的过期时间

header("Expires:Sun,27 Mar 2016 16:38:00 GMT");//GMT 格林尼治标准时间

x小时后过期

$now=time();

$then=gmstrftime("%a,%d %b %Y %H:%M:%S GMT",$now+60*60*3);//3小时后过期

header("Expires:{$then}");

永远不过期

$now=time();

$then=gmstrftime("%a,%d %b %Y %H:%M:%S GMT",$now+365*86440);

header("Expires:{$then}");

 

相关文章:

  • 2021-04-09
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
猜你喜欢
  • 2021-06-21
  • 2021-12-19
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案