note 75394 modified in function.header by danbrown

From: Date: Sun, 07 Dec 2008 18:14:04 +0000
Subject: note 75394 modified in function.header by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147812@lists.php.net to get a copy of this message
You can use the Header command to force a browser to use fresh content (no caching). However, this only works for the HTML code your code generates. When you have updated images for example (with the same filename) then there's a chance that these are still cached. The easiest way to solve this problem I found is changing: <?php print "<img src='yourfile.jpg'>"; ?> into: <?php print "<img src='yourfile.jpg?".time()."'>"; ?> This adds an unique number to the url and wont hurt at all. --was-- You can use the Header command to force a browser to use fresh content (no caching). However, this only works for the HTML code your code generates. When you have updated images for example (with the same filename) then there's a chance that these are still cached. The easiest way to solve this problem I found is changing: <? print "<img src='yourfile.jpg'>"; ?> into: <? print "<img src='yourfile.jpg?".time()."'>"; ?> This adds an unique number to the url and wont hurt at all. http://php.net/manual/en/function.header.php

« previous php.notes (#147812) next »