Re: Re: Weird caching problem with PHP4/Apache
| From: | Tamas Arpad | Date: | Wed, 31 Oct 2001 14:23:50 +0000 |
| Subject: | Re: Re: Weird caching problem with PHP4/Apache | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73016@lists.php.net to get a copy of this message | ||
On Wednesday 31 October 2001 14:48, René Fournier wrote:
> Nope, unfortunately, nothing. It's a really weird problem. It's
> like the PHP function I wrote for generating the random image will
> only work the first time.
I think it is not php that caches it. As I undertsand you wrote a
script that generates an image, and give it back to the browser in an
<img src=...> html tag. Am I right?
I hope I am, so I continue :))
Images can be cached in many places (proxies, browser), but
definietly not in php. Your script that generates in the image and
should be called every time by the <img> html tag, won't ever called
again if the previous image were stored somewhere. You should send
"pragma no-cache" and other http headers (many posts were on this
"cache headers" topic) from the script that generates and gives back
the image.
Or another sollution is that you can call your script with a random
number or better with the current date and time, so you images's name
won't be the same, and caches can't give back the old image.
for example:
<?php echo"<img src=\"generatebackground.php?x=".date("YmdHis").
"\">";?>
Arpi