osh*_*nen 16 html php browser caching browser-cache
根据:http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching我应该使用浏览器缓存.但是,我不知道怎么做.
我只是在html部分添加某些标签吗?或者是我需要通过服务器发送给客户端的东西?与php标题有关吗?
您可以在.htaccess中执行类似的操作.
## EXPIRES CACHING ##
<IfModule mod_expires>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16366 次 |
| 最近记录: |