简体   繁体   English

Codeigniter中的PHP文件不会更新CSS和JS更改

[英]PHP file in Codeigniter does not update CSS and JS changes

I have a project with Codeigniter that worked very well. 我有一个Codeigniter的项目非常好。 I linked my CSS and JS files in my PHP documents and all worked fine. 我在我的PHP文档中链接了我的CSS和JS文件,一切正常。 But now I see that it does not recognize the changes I made to the scripts. 但现在我发现它无法识别我对脚本所做的更改。 For example, I change the Background color in a class but it still show the old color, and same with JS, I change the content of a string but it still show old content. 例如,我在类中更改背景颜色但它仍然显示旧颜色,与JS相同,我更改字符串的内容但它仍然显示旧内容。 But when I link the same scripts to a HTML document, the work correctly and apply the changes. 但是,当我将相同的脚本链接到HTML文档时,正常工作并应用更改。 I'm so confused, I don't know why this happen, it's very strange. 我很困惑,我不知道为什么会这样,这很奇怪。

PD: I'm using bootstrap and all my Scripts are at the end of the body tag PD:我正在使用bootstrap,我的所有脚本都在body标签的末尾

Try clear browser cache. 尝试清除浏览器缓存。

Try open your project on another browser. 尝试在其他浏览器上打开您的项目。

Try clear CodeIgniter cache ( if activated ). 尝试清除CodeIgniter缓存(如果已激活)。

Share your main templates ( how you build HEAD section for instance ) 分享您的主要模板(例如,如何构建HEAD部分)

Put timestamps at the end of your main .css files or .js files like : 将时间戳放在主.css文件或.js文件的末尾,例如:

<link rel="stylesheet" type="text/css" href="/your-css-file.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" />

... in order to load always your latest css source. ...为了始终加载您最新的CSS源。

Use following lines in your head tag 在头标记中使用以下行

Also, put timestamp with your CSS files. 另外,将时间戳放在CSS文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM