Home >Backend Development >PHP Problem >Browser does not update after php modification
The browser does not update after php is modified
1. Reason 1: PHP has set a cache
If this problem exists in php files, it should be in the php5 version. In the php.ini file, the value of opcache.revalidate_freq is set by default. Set to 0, which can solve the php cache problem.
2. Reason 2: Browser cache
a) When accessing the url, you can add some parameters such as:? xxx=123, so that the browser will re-obtain the data
b) PHP script file settings header
//禁止页面缓存 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");//内容过期时间 强制浏览器去服务器去获取数据 而不是从缓存中读取数据 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");//标记内容最后修改时间 header("Cache-Control: no-store, no-cache, must-revalidate");//强制不缓存 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");//禁止本页被缓存 header("Access-Control-Allow-Origin: *"); // Support CORS
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of Browser does not update after php modification. For more information, please follow other related articles on the PHP Chinese website!