HTTP缓存 - 控制 [英] HTTP Cache- Control

查看:136
本文介绍了HTTP缓存 - 控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力解决这个问题 -
在PHP中,我为GET AJAX调用执行此操作

I am struggling with this - In PHP, I do this for a GET AJAX call

header('Cache-Control: max-age = 10000, private');

此后浏览器仍设法发出请求?为什么?

The browser still manages to place a request thereafter? Why?

header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 10000) . ' GMT');

但工作正常!

谢谢

编辑

header("Cache-Control: private, max-age=10000");

似乎有效!!

MORE

规范是明确的。

cache-directive = cache-request-directive | cache-response-directive

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1

推荐答案

你使用Firebug吗?如果是,请在页面加载时转到NET选项卡。检查浏览器看到的标题。这会让你知道可能出现的问题......

Do you use Firebug? If yes, then go to the NET tab when your page loads & inspect what headers the browser is seeing. This will give you an idea as to what might be wrong...

我用这个 -

Cache-Control   public, max-age=60
Content-Type    text/html; charset=utf-8

这篇关于HTTP缓存 - 控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆