php知识点3-HTTP 头部-Cache-Control

WBOY
发布: 2016-07-28 08:27:04
原创
1096 人浏览过

1.概述
Cache-control用于控制HTTP缓存(在HTTP/1.0中可能部分没实现,仅仅实现了Pragma: no-cache)
2.例子
Cache-Control: cache-directive
cache-directive可以为以下:
request时用到:
no-cache
no-store
max-age = delta-seconds
max-stale = delta-seconds
min-fresh = delta-seconds
no-transform"
only-if-cached"
cache-extension"
response时用到:
public
private = field-name
no-cache = field-name
no-store"
no-transform
must-revalidate
proxy-revalidate
max-age = delta-seconds
s-maxage = delta-seconds
cache-extension"
3.分析
Cache-control: max-age=5 
表示当访问此网页后的5秒内再次访问不会去服务器 
Cache-Control: no-cache:这个很容易让人产生误解,使人误以为是响应不被缓存。
实际上Cache-Control: no-cache是会被缓存的,只不过每次在向客户端(浏览器)提供响应数据时,
缓存都要向服务器评估缓存响应的有效性。 
Cache-Control: no-store:这个才是响应不被缓存的意思。

以上就介绍了 php知识点3-HTTP 头部-Cache-Control,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!