为什么对某些php文件的更改需要很长时间才能在实时网站上显示

时间:2020-12-26 19:18:57

I'm using WordPress. Sometimes when I update certain php files in the theme the changes show on the live site right away (header.php for example). However when I make changes to php files in the CSS folder (skin.php) for example, it can take several hours for these changes to be reflected in the live site. Any idea why this takes so long and if there's any was to force it to update. Sounds like a cache issue, but I've cleared my local cache and tried other browsers that have never been to this site and the changes do not show. So maybe some type of cache on the server? I'm not using any cache plugins.

我正在使用WordPress。有时当我更新主题中的某些php文件时,更改会立即显示在实时网站上(例如header.php)。但是,当我对CSS文件夹(skin.php)中的php文件进行更改时,这些更改可能需要几个小时才会反映在实时网站中。知道为什么这需要这么长时间以及是否有任何强迫它更新。听起来像一个缓存问题,但我已经清除了我的本地缓存并尝试了其他从未访问过这个网站的浏览器,并且没有显示更改。那么服务器上可能有某种类型的缓存?我没有使用任何缓存插件。

Example site if this helps. http://freemanep.com/

示例站点,如果这有帮助。 http://freemanep.com/

Thanks.

1 个解决方案

#1


0  

I use Mark Jaquith's solution (see here) to stop my stylesheets being cached. Not sure it applies in your case, given it happens on a new browser, but it's worth a try.

我使用Mark Jaquith的解决方案(见这里)来阻止我的样式表被缓存。不确定它适用于您的情况,因为它发生在新的浏览器上,但它值得一试。

In essence you append the file modification timestamp to the URL, so when the file changes, the browser thinks the URL has changed and downloads the latest version. Mark's example, for the theme stylesheet:

实质上,您将文件修改时间戳附加到URL,因此当文件更改时,浏览器会认为URL已更改并下载最新版本。 Mark的例子,主题样式表:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen, projection" />

#1


0  

I use Mark Jaquith's solution (see here) to stop my stylesheets being cached. Not sure it applies in your case, given it happens on a new browser, but it's worth a try.

我使用Mark Jaquith的解决方案(见这里)来阻止我的样式表被缓存。不确定它适用于您的情况,因为它发生在新的浏览器上,但它值得一试。

In essence you append the file modification timestamp to the URL, so when the file changes, the browser thinks the URL has changed and downloads the latest version. Mark's example, for the theme stylesheet:

实质上,您将文件修改时间戳附加到URL,因此当文件更改时,浏览器会认为URL已更改并下载最新版本。 Mark的例子,主题样式表:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen, projection" />