The header() function of PHP advanced application sets the browser cache
This involves 4 header types:
Last-Modified (last modification time);
Expires( Validity period);
Pragma (compilation directive);
Cache-Control (cache control);
The first three headers belong to the HTTP1.0 standard. The Last-Modified header uses UTC date and time values. If the caching system sees that the Last-Modified value is closer to the current time than the cached version of the page, it knows it should use the new version from the server.
Expires indicates when the cached version should expire (GMT). Setting this to a previous time will force the page on the server to be used.
Pragma defines how the page data should be processed. You can avoid caching the page like this:
header("Pragma:no-cache");
Cache-Co0ntrol The header was added in HTTP1.1 and can achieve more detailed Control (should also continue to use HTTP 1.0 headers). There are many
settings for Cache-Control, as shown in the following table:
directive Cannot be cached anywhere
must-revalidate The cache must check for an updated version
proxy-revalidate The proxy cache must check for an updated version
max-age The period during which the content can be cached, expressed in seconds
s-maxage Overrides the max-age of the shared cache Age setting
The following example uses header() to set the browser's cache:
// Connect to the database:
$dbc = @mysqli_connect ( localhost, username, password, test) OR die (
Could not connect to the database!