本文實(shí)例匯總了各類常見(jiàn)語(yǔ)言清除網(wǎng)頁(yè)緩存方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
一般來(lái)說(shuō),清除緩存我們只需要設(shè)置頁(yè)面為no-cache就可以了,當(dāng)然像asp,php這種只需要設(shè)置Expires操作即可,具體如下。
HTML網(wǎng)頁(yè):
復(fù)制代碼 代碼如下:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
或者復(fù)制代碼 代碼如下:
<META HTTP-EQUIV="expires" CONTENT="0">
ASP網(wǎng)頁(yè):
復(fù)制代碼 代碼如下:
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
PHP網(wǎng)頁(yè):
復(fù)制代碼 代碼如下:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
JSP網(wǎng)頁(yè):
復(fù)制代碼 代碼如下:
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);
希望本文所述對(duì)大家的web程序設(shè)計(jì)有所幫助。