如何强制浏览器显示CSS文件的最新更改? [英] How to force a browser to show the latest changes to a CSS file?

查看:298
本文介绍了如何强制浏览器显示CSS文件的最新更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP网站上对CSS文件进行了一些更改。

I made some changes on a CSS file on a PHP site.

这些更改不会显示在任何浏览器中,直到我按住< kbd> CTRL 键,然后点击浏览器的 REFRESH 按钮。

The changes do not show up in any browser I test it on until I hold down the CTRL key and click the browser's REFRESH button.

这意味着大多数用户都不会

This means that most users are not going to seem the changes I made.

如何强制浏览器立即显示对CSS文件的更改(不重命名CSS文件)? b $ b

推荐答案

在链接样式表时,添加一个唯一的字符串作为查询字符串。下面是一个例子

Add a unique string as query string when linking the stylesheet. Here's an example

<link href="style.css?<?=filemtime("style.css")?>" rel="stylesheet" type="text/css" />

这篇关于如何强制浏览器显示CSS文件的最新更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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