How to clear browser cache when re-uploading image with same filename, in php?

后端 未结 8 1499
灰色年华
灰色年华 2021-02-18 19:05

I have a listing of items, that also contains an image thumbnail. Sometimes I need to change the thumbnail image, but keep the filename the same. Is there a way to force the bro

8条回答
  •  鱼传尺愫
    2021-02-18 19:36

    Please use these rules in your .htaccess file. I used these rules and solved my problem related to image re-uploading with the same file name.

    # BEGIN Caching
    
        
            Header set Cache-Control "max-age=0, public"
        
        
                Header set Cache-Control "max-age=604800, public"
        
        
            Header set Cache-Control "max-age=216000, private"
        
        
            Header set Cache-Control "max-age=216000, public, must-revalidate"
        
        
            Header set Cache-Control "max-age=1, private, must-revalidate"
        
    
    # END Caching
    

提交回复
热议问题