禁止本页面被缓存(html,asp,jsp,php,.net)
htm网页
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache,must-revalidate">
<metahttp-equiv="expires"content="wed,26feb199708:21:57gmt">
或者<metahttp-equiv="expires"content="0">
asp网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
.net网页
response.Buffer = False
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0/-1
清除图片缓存
Response.Cache.SetCacheability(HttpCacheability.No Cache)
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp网页
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
htm网页
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache,must-revalidate">
<metahttp-equiv="expires"content="wed,26feb199708:21:57gmt">
或者<metahttp-equiv="expires"content="0">
asp网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
.net网页
response.Buffer = False
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=0/-1
清除图片缓存
Response.Cache.SetCacheability(HttpCacheability.No Cache)
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp网页
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
本文介绍了如何通过HTML、ASP、JSP、PHP及.NET等不同网页技术来禁止页面被浏览器缓存的方法。对于HTML页面,可以使用<meta>标签设置pragma和cache-control属性;ASP页面则可通过response对象设置expires和cachecontrol属性;JSP、PHP和.NET也有各自的实现方式。
3758

被折叠的 条评论
为什么被折叠?



