note 22093 added to function.rand
| From: | andrew at heyotwell dot com | Date: | Thu, 06 Jun 2002 10:19:21 +0000 |
| Subject: | note 22093 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31527@lists.php.net to get a copy of this message | ||
Quick and dirty way to help avoid image caching in the browser: use rand() to append a random number
to the end of the img src element:
echo <img src=\"blah.gif?\".rand(1,999)."width=\"100\"
height=\"100\">
browsers will see
<img src="blah.gif?453" width="100" height="100">
They ignore the stuff past the ?, but it's enough to make the request different from the
previous one, meaning the browser will get the image off the server again.
Not 100% reliable, but what is?
--
http://www.php.net/manual/en/function.rand.php
http://master.php.net/manage/user-notes.php?action=edit+22093
http://master.php.net/manage/user-notes.php?action=delete+22093
http://master.php.net/manage/user-notes.php?action=reject+22093