Page Caching
Because HTML pages generated by PHP scripts are made on the fly, they frequently should not be cached by Web browsers and proxy servers (caching is a matter of referring to a saved version of a page rather than the original when a URL is requested). However, ISPs often cache popular sites to improve performance, and users sometimes adjust the caching policy of their browsers per their needs (Figure 10.3). As a PHP developer, you can use the header() function to explicitly control caching.
Figure 10.3. Caching settings can be altered in many browsers.
To prevent a page from being cached:
1. | Create a new PHP document (Script 10.3 ... |
Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.