强制浏览器缓存图像

编程入门 行业动态 更新时间:2024-10-24 02:38:07
本文介绍了强制浏览器缓存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我生成图像,并希望浏览器缓存永远它们,而是浏览器缓存从来没有在他们所有。这是我的PHP code

I am generating the images and want browser to cache them forever, but instead browser never cache them at all. This is my php code

header('Content-type:'.$file->content_type); header('Expires: Thu, 15 Apr '.(date('Y')+10).' 20:00:00 GMT'); header('Content-Disposition: attachment; filename="'.$file->file_name.'"'); echo(file_get_contents($model_files->files_path.$file->md5.$model_files->seprator.$file->file_name));

和这些都是我不断收到在浏览器的响应头。

and these are the response headers which i keep getting in browser.

Date: Thu, 02 Jun 2011 12:56:56 GMT Server: Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 X-Powered-By PHP/5.2.15 Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache Expires Thu, 15 Apr 2021 20:00:00 GMT Content-Length 321823 Keep-Alive timeout=5, max=100 Connection Keep-Alive Content-Type image/png

我没有设定日期,缓存控制和附注,但保持让他们响应。

I am not setting Date, Cache-Control and Pragma but keep getting them in response.

我知道我可以覆盖他们,但老实说,我不知道究竟哪些值来设置。

I know i can overwrite them but honestly i don't exactly know which values to set.

推荐答案

有一个看的 session_cache_limiter 。

Have a look at session_cache_limiter.

更多推荐

强制浏览器缓存图像

本文发布于:2023-10-31 19:06:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547000.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   图像   浏览器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!