How PHP prohibits browsers from using cached pages
Page slow exists sometimes is not necessary, we can prohibit the browser cache page.
In PHP can easily use the following statement to implement prohibit page caching, but it is difficult to remember the special arrangement, convenient for everyone to use.
The PHP code is as follows:
The code is as follows:
Set the expiration time for this page (in GMT), as long as the date has passed.
Header ("Expires:mon, Jul 1970 05:00:00 GMT");
Set the last update date for this page (expressed in GMT) to force the browser to get the latest information for the current day
Header ("last-modified:".) Gmdate ("D, D M Y h:i:s"). " GMT ");
Tells 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, compatible with the HTTP 1.0 protocol
Header ("Pragma:no-cache");
?>
This is useful for some pages, such as single information and items under orders, and emptying the cart for product data.
Certainly do not want users to the last page, have already generated orders, and then click the browser's return button back to the previous page.
Then on the Order Address page, add:
The code is as follows:
Header ("Cache-control:no-cache,must-revalidate,no-store"); After this no-store is added, Firefox works
Header ("Pragma:no-cache");
Header ("Expires:-1");
This page does not cache, and there is a judgment shopping cart product is empty jump to empty shopping cart page, then the user click the browser back, back, also directly to the shopping cart page.
http://www.bkjia.com/PHPjc/907714.html www.bkjia.com true http://www.bkjia.com/PHPjc/907714.html techarticle PHP prevents browsers from using cached pages in a way that is sometimes unnecessary, and we can disallow browsers from caching pages. In PHP, it is easy to use the following statement in real ...