Home  >  Article  >  Backend Development  >  How to prevent caching using php

How to prevent caching using php

不言
不言Original
2019-01-11 14:56:103363browse

We cannot clear the browser cache from the PHP side. For this reason, you may want to prevent browser caching from all aspects from the beginning. This article will introduce to you how to use PHP to prevent caching. .

How to prevent caching using php

Finally, I'll tell you how to do it.

The implementation method is to write the following code into the PHP file.

This means that we will not cache the command header information as a whole.

Let’s briefly explain the code

no-store: Do not cache responses or requests

no-cache: Disable reuse without confirmation on the server side

max-age: Because of the cache expiration age (in seconds), 0 means there is no valid time

When checking on the Internet, the following description also appears, but some browsers report Events that will be cached.

header("Cache-Control: no-cache");
header("Pragma: no-cache");

Summary, the above is the entire content of this article. For more other exciting articles, you can pay attention to the relevant column tutorials of the PHP Chinese website! ! !

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

Statement:
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
Previous article:What is ApacheNext article:What is Apache