Re: [Phplib-users] page expiry problems
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@dr...> - 2003-07-01 21:15:08
|
> 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
|