Re: [Phplib-users] page expiry problems
Brought to you by:
nhruby,
richardarcher
From: Frank B. <fb...@sy...> - 2003-07-01 22:24:41
|
At 05:14 PM 7/1/03, Layne Weathers wrote: >>Thanks for the ideas, but my scripts will be accessed very infrequently >>and I will not remember to convert them to static pages each time I make >>changes to them. I have figured out that inserting the following line at >>top of a script appears to cause browser to cache the page (at least for >>current browser session, close/reopen browser and pages are retrieved >>again - as expected). >> >>header('Last-Modified: '.date( 'r', >>filemtime($HTTP_SERVER_VARS['SCRIPT_FILENAME']) )); >> >>But scripts that call phplib's page_open function are not affected (ie: >>not cached) by this change? > >Put your header declaration *after* page_open() - the default PHP behavior >is to overwrite previously set headers of the same name. FWIW, when I send >an image file through a PHP script, I send the following headers, mainly >taken from session.inc: > >header("Expires: " . gmdate("D, d M Y H:i:s", time() + 1440 * 60) . " GMT"); >header("Last-Modified: " . gmdate("D, d M Y H:i:s", >filemtime("./logo.gif")) . " GMT"); >header("Cache-Control: public"); >header("Cache-Control: max-age=" . 1440 * 60, false); >header("Pragma: public"); > >HTH, >Layne Weathers If PHP overwrites headers with same name, how can your example have two "Cache-Control" headers? Placing my "header" code after page_open didn't help. I had a look at session.inc (phplib 7.2d) and thought that the following code should accomplish the intended result: class BK5_Session extends Session { var $classname = "BK5_Session"; var $that_class = "CT_Sql_BK5"; var $allowcache = "private"; } But that didn't work either - pages are not being cached. |