Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

css - Why do changes to some php files take so long to show on the live site

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.

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

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...