How to prevent Browser cache for php site

前端 未结 5 1086
野趣味
野趣味 2020-11-22 10:34

I have a php site running in cloud server.When ever i add new files css, js or images the browser is loading the same old js, css and image files stored in cache.

My

5条回答
  •  忘了有多久
    2020-11-22 11:11

    You can try this:

        header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
        header("Connection: close");
    

    Hopefully it will help prevent Cache, if any!

提交回复
热议问题