且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP缓存控制似乎不起作用

更新时间:2022-06-16 10:03:57

问题不在此页面而不在PHP脚本中。请参阅Google的建议:

Problem not in this page and not in PHP scripts. See Google's suggestions:


以下可缓存资源的新生命周期为
。在以下资源的
期货中指定至少一周的
到期日期:

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

  • http://www.vynora.com/arrow.png (expiration not specified)
  • http://www.vynora.com/bing.png (expiration not specified)
  • http://www.vynora.com/dailymotion.png (expiration not specified)
  • http://www.vynora.com/dd_arrow.gif (expiration not specified)
  • http://www.vynora.com/deviantart.png (expiration not specified)
  • http://www.vynora.com/flickr.png (expiration not specified)
  • http://www.vynora.com/google.png (expiration not specified)
  • ...

这意味着,您应该缓存静态文件。 >
正如我所看到的,你使用的是Apache。在这种情况下,您可以使用 mod_expires

It means, you should cache your static files.
As I can see, you use Apache. In this case you can use mod_expires

例如,您可以在此行中添加 .htaccess 文件:

For example, you can add into .htaccess file this lines:

ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 86400 seconds"
ExpiresByType application/x-javascript "access plus 86400 seconds"