Php comprehensively disables browser cache page content explanation

Source: Internet
Author: User
Tags browser cache

Code

The code is as follows: Copy code

Header ("Cache-Control: no-cache, must-revalidate, no-store"); // This no-store is valid in Firefox after it is added.
Header ("Pragma: no-cache ");
Header ("Expires:-1 ");

This page is no longer cached, and a page will jump to the empty shopping cart if it is determined that the shopping cart item is empty. Then, the user clicks the browser and returns to the shopping cart page.

PHP disables browser cache pages

The code is as follows: Copy code

<? Php
  
// Set the expiration time of this page (expressed by Greenwich Mean Time), as long as it is a date that has passed.
Header ("Expires: Mon, 26 Jul 1970 05:00:00 GMT ");
  
// Set the last update date (expressed by Greenwich Mean Time) on this page to the current day. You can force the browser to obtain the latest information.
Header ("Last-Modified:". gmdate ("D, d m y h: I: s"). "GMT ");
  
// Tell the client browser not to use the cache, HTTP 1.1 Protocol
Header ("Cache-Control: no-cache, must-revalidate ");
  
// Tells the client browser not to use the cache and is compatible with the HTTP 1.0 Protocol
Header ("Pragma: no-cache ");
  
?>


However, the preceding three statements are valid in IE and invalid in FF, and the following sentence is added in FF.

The code is as follows: Copy code

<Meta http-equiv = "Cache-Control" content = "no-store">


I found a method to display the latest webpage content under any circumstances, as described below:

Change the webpage link:

Http://xxx.yyy.zzz/page.php? Rand = XXXXXXX

In the example.


Other methods such as asp and jsp

ASP:

The code is as follows: Copy code

Response. expires = 0
Response. addHeader ("pragma", "no-cache ")
Response. addHeader ("Cache-Control", "no-cache, must-revalidate ")

JSP:

The code is as follows: Copy code

Response. setHeader ("Pragma", "No-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires", 0 );

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.