为什么对某些 php 文件的更改需要很长时间才能在实时站点上显示 [英] Why do changes to some php files take so long to show on the live site

查看:22
本文介绍了为什么对某些 php 文件的更改需要很长时间才能在实时站点上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

示例站点(如果有帮助).http://freemanep.com/

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

谢谢.

推荐答案

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

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.

本质上是将文件修改时间戳附加到 URL 上,所以当文件发生变化时,浏览器会认为 URL 发生了变化并下载最新版本.Mark 的示例,用于主题样式表:

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:

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

这篇关于为什么对某些 php 文件的更改需要很长时间才能在实时站点上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆