You are here: Re: how to mark php document as cachable (expires only when php file changes) « PHP Programming Language « IT news, forums, messages
Re: how to mark php document as cachable (expires only when php file changes)

Posted by Michael Winter on 11/04/14 11:24

On 18/08/2005 23:15, News KF wrote:

> I'm new to cahce control, [...]

The caching tutorial[1] by Mark Nottingham is well worth a read, but I
strongly suggest that you read RFC 2616, especially section 13, for more
detailed information. You will also want to read about the various
headers that can be involved in caching: Cache-Control (14.9), ETag
(14.19), Expires (14.21), conditional requests (14.24-6,8), and
Last-Modified (14.29).

[snip]

> So what exact header would I have to pass to indicate to make the
> browser understand, that the php file does not have to be refetched,
> except the php file (its creation date) changed.

You could send the Last-Modified header with a value reflecting the last
modified time of the PHP file:

header('Last-Modified: '
. gmdate('D, d M Y H:i:s', getlastmod())
. ' GMT');

Mike


[1] <URL:http://www.mnot.net/cache_docs/>

--
Michael Winter
Prefix subject with [News] before replying by e-mail.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация