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>
asp tutorialHow to do
Response.Buffer = True Response.ExpiresAbsolute = Now() - 1 Response.Expires = 0 Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "No-Cache"
php tutorialHow to do
<?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-reval idate '); header('Pragma: no-cache'); ?>
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!