note 8653 added to header

From: Date: Fri, 22 Sep 2000 08:23:09 +0000
Subject: note 8653 added to header
Groups: php.notes 
Request: Send a blank email to php-notes+get-5321@lists.php.net to get a copy of this message
Speaking of cacheability, allowing your basic php documents to be cached for a short period is often a very good idea. For example, I have php files that simply interpret text files. They always give the same output, so they may as well be long-term cacheable. How to do this easily? I wrote a quick function called CacheControl (consider it under the GPL) based on information available at: http://www.mnot.net/cache_docs/ ("How to make your documents work with web caches"). function CacheControl($maxage, $smaxage) { $Modified = "Last-modified: ".gmdate("D, d M Y H:i:s", time())." GMT"; $Expires = "Expires: ".gmdate("D, d M Y H:i:s", time() + $maxage)." GMT"; $CacheControl = "Cache-Control: must-revalidate, max-age=".$maxage.", "; $CacheControl.= "s-max-age=".$smaxage; Header($CacheControl); Header($Modified); Header($Expires); } http://ca.php.net/manual/function.header.php

« previous php.notes (#5321) next »