禁止页面缓存的几种方法
发布时间:2018-03-28 编辑:jiaochengji.com
本文介绍了禁止页面缓存的几种方法,包括html中禁用页面缓存、php代码禁用页面缓存等,有需要的朋友参考下。
如何禁止页面缓存的方法。
1,html禁止页面缓存,只要加在头部就可以了.
复制代码 代码示例:
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
2,asp中的方法
复制代码 代码示例:
response.buffer = true
response.expiresabsolute = now() - 1
response.expires = 0
response.cachecontrol = "no-cache"
response.addheader "pragma", "no-cache"
response.expiresabsolute = now() - 1
response.expires = 0
response.cachecontrol = "no-cache"
response.addheader "pragma", "no-cache"
3,php中禁止页面缓存。
复制代码 代码示例:
<?php
header('expires: mon, 26 jul 1997 05:00:00 gmt');
header('last-modified: ' . gmdate('d, d m y h:i:s') . 'gmt');
header('cache-control: no-cache, must-revalidate');
header('pragma: no-cache');
?>
header('expires: mon, 26 jul 1997 05:00:00 gmt');
header('last-modified: ' . gmdate('d, d m y h:i:s') . 'gmt');
header('cache-control: no-cache, must-revalidate');
header('pragma: no-cache');
?>
另一种最简单的方法,就是ajax时用?mt=随便数据也是可以的。
相关阅读:使用ajax防止页面缓存的代码
您可能感兴趣的文章:
禁止页面缓存的几种方法
Jquery 禁用缓存的方法介绍
禁止页面缓存的方法 多语言下禁止页面缓存
js禁止页面F5刷新 右键与后退的代码
javascript禁止网页右键的方法
ASP.NET中清除缓存(禁止页面缓存)
清除IE缓存的方法汇总(asp asp.net php等)
如何禁用aspx页面的客户端缓存
javascript禁止页面操作(右键、复制、F5刷新)等代码
php禁止页面缓存输出的代码
[关闭]