Is there a way to force browsers to refresh/download images?

后端 未结 14 2208
囚心锁ツ
囚心锁ツ 2020-11-29 01:21

I have a problem where users are reporting that their images aren\'t being uploaded and the old ones are still there. On closer inspection the new images are there, they jus

14条回答
  •  萌比男神i
    2020-11-29 01:51

    in PHP you can use this trick

    
    

    The time() function show the current timestamp. Every page load is different. So this code deceive the browser: it read another path and it "think" that the image is changed since the user has visited the site the last time. And it has to re-download it, instead of use the cache one.

提交回复
热议问题