Home > Web Front-end > HTML Tutorial > How to disable page caching

How to disable page caching

php中世界最好的语言
Release: 2018-02-05 09:28:15
Original
3151 people have browsed it

This time I will bring you the prohibition of pagesCachingWhat are the methods and what are thePrecautionsof prohibiting page caching. The following is a practical case, let’s take a look.

I encountered a method during development today, that is, the customer requested that the page not be cached. After checking, I found the following ways to prevent the page from being cached

html
Just add it in Just the head.

<HEAD>  
<META     HTTP-EQUIV="Pragma"     CONTENT="no-cache">  
<META     HTTP-EQUIV="Cache-Control"     CONTENT="no-cache">  
<META     HTTP-EQUIV="Expires"     CONTENT="0">  
</HEAD>
Copy after login

asp tutorialHow to do

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

php tutorialHow to do

<?php 
header(&#39;Expires: Mon, 26 Jul 1997 05:00:00 GMT&#39;); 
header(&#39;Last-Modified: &#39; . 
gmdate
(&#39;D, d M Y H:i:s&#39;) . &#39;GMT&#39;); 
header(&#39;Cache-Control: no-cache, must-reval
idate
&#39;); 
header(&#39;Pragma: no-cache&#39;); 
?>
Copy after login

There is also a simpler method, which is what everyone uses when using ajax?mt=any data

I believe you have mastered the method after reading these cases. Please pay attention to php Chinese website for more exciting thingsOthersRelated articles!

Related reading:

How to set input to read-only effect through disabled and readonly

HTML head tag meta How to implement refresh redirection

How to use the form internal tags of html

The above is the detailed content of How to disable page caching. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template