simple-etag.php

This is a basic example of how to use the HttpCaching class to set an ETag.

00001 <?php
00002 require('HttpCaching2.php');
00003 $hc = new HttpCaching();
00004 $hc->freshFor("1 hour");
00005 $hc->ccMustRevalidate(true);
00006 $hc->weakEtag("foo");
00007 $hc->sendStatusAndHeaders(true);
00008 /*
00009  * This sends the following headers:
00010  * Expires: Sat, 26 Aug 2006 12:00:07 GMT
00011  * Cache-Control: must-revalidate, max-age=3600
00012  * ETag: W/"foo"
00013  * at:
00014  * Date: Sat, 26 Aug 2006 11:00:07 GMT
00015  */
00016 ?>

PHP HTTP Caching
Hugo Haas