简体   繁体   English

避免 Chrome 保存 .txt 和 .php 文件缓存

[英]Avoid Chrome saving .txt and .php files to cache

I am developing a web page (2075.mooo.com, (it is in Catalan)) where teachers control students' arrivals with an NFC card in an Arduino.我正在开发一个 web 页面(2075.mooo.com,(它在加泰罗尼亚语中)),教师使用 Arduino 中的 NFC 卡控制学生的到达。

The thing is that I save students' data on.txt files, but Chrome saves those to its cache, and I have to constantly remove the cache files.问题是我将学生的数据保存在 .txt 文件中,但 Chrome 将这些数据保存到缓存中,我必须不断删除缓存文件。 Is there a way to not let Chrome do that or use another strategy instead of.txt files?有没有办法不让 Chrome 这样做或使用其他策略而不是 .txt 文件? Because I cannot say to all teachers and students to remove their chrome cache.因为我不能要求所有的老师和学生删除他们的 chrome 缓存。

Thanks.谢谢。

If using Apache:如果使用 Apache:

Add this to a .htaccess file created in the directory you save the.txt files:将此添加到在您保存 .txt 文件的目录中创建的.htaccess文件中:

Header always set Pragma "no-cache"
Header always set Cache-Control "no-store, must-revalidate"
Header always set Expires "0"

OR或者

If you have access to httpd.conf, you can add the following to it:如果您有权访问 httpd.conf,则可以向其中添加以下内容:

<LocationMatch ".*\.txt">
     Header always set Pragma "no-cache"
     Header always set Cache-Control "no-store, must-revalidate"
     Header always set Expires "0"
</LocationMatch>

They must clear the cache that they already have in their browser.他们必须清除浏览器中已有的缓存。

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

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