|
![]() |
Last Modified Header
Using Php it is really easy to create dynamic pages on the fly
and output the resultant HTML to the user's web browser. Some
user clients (browsers) check a header called the Last-Modified
header to see if they should download a new version of the page
Since the page (as a static HTML document) doesn't exist, it
is sometimes convenient to send a Last-Modified header
that will tell the user-agent to always download a new
version of the file. Beware that this could cause more
bandwidth usage.
Page Always Modified Header
Example Code |
---|
<?php // This example is straight from the php manual at php.net // Send a header telling the UA that the page is always modified. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ?>
|
Remember that when you want to send headers using Php, you must
do so before *any* output is sent to the browser. This means it must
be at the very top of the file and you must have no blank lines before
the opening Php tag "<?php ". The reason for this is that
before PHP can start outputting your HTML code, it must first send
headers to the client. This means that if there is a space at the
top of the file, that will be considered part of the HTML output
that needs to be sent to the browser, and before sending that, PHP will
send standard headers.
|
|