一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

禁止页面缓存的几种方法

时间:2011-09-17 编辑:简简单单 来源:一聚教程网

今天在开发时碰到一种方法,就是客户要求页面不缓存,查了一下得出如下几种不让页面缓存的办法


html
只要加在头部就可以了.

 
     
     
     
     

asp教程做法

Response.Buffer     =     True 
    Response.ExpiresAbsolute     =     Now()     -     1 
    Response.Expires     =     0 
    Response.CacheControl     =     "no-cache" 
    Response.AddHeader     "Pragma",     "No-Cache" 

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');
?>

还有一种更简单的方法,就是大家ajax时用到的?mt=随便数据

热门栏目