Disable cache for some images

前端 未结 13 1116

I generate some images using a PHP lib.

Sometimes the browser does not load the new generated file.

How can I disable cache just for images created dynamica

13条回答
  •  有刺的猬
    2020-11-22 08:20

    I've used this to solve my similar problem ... displaying an image counter (from an external provider). It did not refresh always correctly. And after a random parameter was added, all works fine :)

    I've appended a date string to ensure refresh at least every minute.

    sample code (PHP):

    $output .= "\"somecounter.com\"";
    

    That results in a src link like:

    http://xy.somecounter.com/?id=1234567890&1207241014
    

提交回复
热议问题