Home > Web Front-end > HTML Tutorial > Share several ways to disable page caching_HTML/Xhtml_Web page production

Share several ways to disable page caching_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:38:19
Original
1519 people have browsed it

Today I encountered a method during development, 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 to the head.

Copy the code
The code is as follows:






asp tutorial method

Copy code
The code is as follows:

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

php tutorial method


Copy the code
The code is as follows:

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

There is also a simpler method, which is what everyone uses for ajax?mt=any data
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