PHP Advanced and object-oriented Programminglarry Ullman last-modified Last modified time expires expiration pragma compile hint Cache-control Cache control such as the cache system discovers that the value of last-modified is closer to the current time than the page cache version, it knows that the updated page version from the server should be used.
Caching-both in Web browsers and proxy Servers-can is affected using PHP ' s header () function. Four header types is involved:
last-modified
expires
pragma
Cache-control
The first three header types is part of the HTTP 1.0 standard. The last-modified header uses a UTC (coordinated Universal time) date-time value. If a caching system sees that the last-modified Valueis more recent than the date on the cached version of the page, it kn oWS to use the new version from the server. Expires is used as a indicator as to when a cached version of the page should no longer be used (Ingreenwich Mean time).
Setting an Expires value in the past should all force the page from theserver to be used:
Header ("Expires:mon, Jul 1997 05:00:00 GMT");
Pragma is just a declaration for how the page data should be handled. To avoid caching of a page, use
Header ("Pragma:no-cache")
The Cache-control headers were added in HTTP 1.1 and are a more finely tuned option.
Directive meaning
Public Can be cached anywhere
Private only cached by browsers
No-cache cannot be cached anywhere
Must-revalidate Caches must check for newer versions
Proxy-revalidate Proxy caches must check for newer versions
Max-age A duration, in seconds, then the content is cacheable
S-maxage Overrides The Max-age value for shared caches
Keep all systems from caching a page
Header ("Last-modified:mon, 05:00:00 GMT"); Right now!
Header ("Expires:mon, Jul 1997 05:00:00 GMT"); The Back then!
Header ("Pragma:no-cache");
Header ("Cache-control:no-cache");
Pragma:no-cache