转自:http://www.phpernote.com/seo/197.html
网页缓存Js,css以及图片导致页面刷新无效果的三种解决办法,如下:
方法一(php页面添加):
1 |
header( "Expires:
Mon, 26 Jul 1997 05:00:00 GMT" ); |
2 |
header( "Cache-Control:
no-cache, must-revalidate" ); |
3 |
header( "Pragma:
no-cache" ); |
方法二(html的head块中):
1 |
< META HTTP-EQUIV = "pragma" CONTENT = "no-cache" > |
2 |
< META HTTP-EQUIV = "Cache-Control" CONTENT = "no-cache,
must-revalidate" > |
3 |
< META HTTP-EQUIV = "expires" CONTENT = "Wed,
26 Feb 1997 08:21:57 GMT" > |
4 |
< META HTTP-EQUIV = "expires" CONTENT = "0" > |
方法三:
对于图片或者css,可使用如下方式:
1 |
< img src = "./data/avatar_mingpian_bak.jpg?rand=h9xqeI" width = "156" height = "98" > |
对于js则可以直接使用时间戳:
1 |
< script language = "javascript" src = "UILib/Common/Common.js?time=new
Date()" > |