duanmanmian7589 2012-09-26 10:12
浏览 89
已采纳

缓存控制失败

My index.php page keeps being cached, showing old timer values and others, even though I'm using this:

session_cache_limiter( 'nocache' );
session_start( );
header( 'Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0' );

to keep the browser from caching the page. I've checked the headers output in Firefly and they keep saying:

Cache-Control:private, max-age=10800, pre-check=10800

I used to have this in the HTML META:

<META HTTP-EQUIV="cache-control" content="no-cache" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

But have already disabled those in order to check if they were interfering, but enabled or disabled doesn't make a difference.

All help is appreciated!

  • 写回答

2条回答 默认 最新

  • doupengxie4195 2012-09-26 10:42
    关注

    Headers output in FireFly is still Cache-Control private, max-age=10800, pre-check=10800, no-cache, must-revalidate, post-check=0, pre-check=0

    This implies that since you are setting this:

    Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
    

    Some other component/configuration in your app/page is setting this:

    Cache-Control: private, max-age=10800, pre-check=10800
    

    and both are sent to the end user. The "Cache-Control: private" overrides your values when browser reads them, causing the page to be cached.

    Note: header() will by default override any headers that are previously set, so it might be that something is setting that after your line of code, since your line should override any previous ones.

    You need to find out what is setting those "private" cache-control headers and disable/comment that, otherwise it will not work. Maybe some other section later in your code?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?