Created
August 14, 2011 00:26
Revisions
-
johnlettman-old created this gist
Aug 14, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ <?php $_HEADERS = apache_request_headers(); # Get client headers. $updateTime = strtotime('yesterday'); # Makes sure that it always caches. /* Mock page content. Change this after first view. If refreshing shows the old content, then the test worked! */ $content = 'test!'; if(isset($_HEADERS['If-Modified-Since']) && (strtotime($_HEADERS['If-Modified-Since']) == $updateTime)) { // Unmodified! header('Last-Modified: '.gmdate('D, d M Y H:i:s', $updateTime).' GMT', true, 304); exit; } else { // Modified or unsupported! header('Last-Modified: '.gmdate('D, d M Y H:i:s', $updateTime).' GMT', true, 200); echo $content; }