How to force the browser to reload cached CSS/JS files?

后端 未结 30 4398
青春惊慌失措
青春惊慌失措 2020-11-21 05:49

I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even be

30条回答
  •  青春惊慌失措
    2020-11-21 05:52

    If you're using git + PHP, you can reload the script from cache each time there is a change in the git repo, using the following code:

    exec('git rev-parse --verify HEAD 2> /dev/null', $gitLog);
    echo '  '.PHP_EOL;
    

提交回复
热议问题