简体   繁体   English

重新检查文件以获取更新的内容

[英]Rechecking a file for updated content

I'm trying to recheck a file on a timed interval. 我正在尝试按一定时间间隔重新检查文件。 I'm not sure if this can be accomplished, but any help would be greatly appreciated. 我不确定是否可以实现,但是任何帮助将不胜感激。 I understand that as PHP is server-sided, it cannot accomplish my task, so anything with JavaScript is fine. 我了解,由于PHP是服务器端的,因此它无法完成我的任务,因此使用JavaScript进行任何操作都可以。

By rechecking a file, I mean getting a file's contents, but only if it's updated. 通过重新检查文件,我的意思是获取文件的内容,但前提是文件已更新。 Somewhat like "if file gets new contents, output them." 类似于“如果文件获得新内容,则输出它们”。

If you are checking on a remote file, then the PHP solution would be best: simply send the file and its checksum, then when the checksum changes, the file has been updated. 如果您正在检查远程文件,那么PHP解决方案将是最好的:只需发送文件及其校验和,然后在校验和更改时,文件就已更新。

If you're working with a local file, then (if I'm seeing things right) you'll need a browser with the HTML5 File API. 如果您使用的是本地文件,那么(如果我没事的话),您将需要具有HTML5 File API的浏览器。 May be a duplicate of this: Check if file has changed using HTML5 File API 可能与以下内容重复: 使用HTML5 File API检查文件是否已更改

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

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