Disable cache for some images

前端 未结 13 1125

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:21

    Browser caching strategies can be controlled by HTTP headers. Remember that they are just a hint, really. Since browsers are terribly inconsistent in this (and any other) field, you'll need several headers to get the desired effect on a range of browsers.

    header ("Pragma-directive: no-cache");
    header ("Cache-directive: no-cache");
    header ("Cache-control: no-cache");
    header ("Pragma: no-cache");
    header ("Expires: 0");
    

提交回复
热议问题