I have a website that I host with PHPFog. PHPFog, for those who don't know, makes it very easy to deploy an app to multiple application servers with a simple git-push. I would love it if there was some way to automatically update the version number of my javascript/css files with every git-commit or git-push. Or somehow maybe just append the 'build' unix timestamp to the filename. The goal of course to queue browsers to reload the asset file instead of going with the cached version. Does anyone know of a good way to do this?
1条回答 默认 最新
- duanjiao5723 2011-08-01 21:33关注
You can append a bogus query string to your CSS files - such as
styles.css?<?php print $release; ?>
The release identifier can be anything you want - perhaps a timestamp, git hashref, or tag.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报