Home | Php | JavaScript | SQL | HTML | Server Admin | Tools

Gzip Compression
Date and Time
Sending Mail
Header Last Modified
Other sites
Image Editor
Top 10 web hosting reviews

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
// 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.

Link back to this page

Copy and paste this HTML code into your page to link back to this very page:

Or just link to the WebCodingTech site:

And your link will look like this:
      Inspired by stuff found at www.webcodingtech.com.


Copyright © 2005 WebCodingTech.com Our URL is: http://www.webcodingtech.com