[英]PHP filesize won't update; even with clearstatcache();
I have this file: 我有这个文件:
<html>
</html>
<script>
setInterval(function () {
<?php clearstatcache(); ?>
var ss = "<?php echo filesize('log.html'); ?>";
console.log(ss);
},100);
</script>
But if I empty out the file log.html
the browser still outputs the old filesize. 但是,如果我清空
log.html
文件,浏览器仍然会输出旧的文件大小。 Am I doing something wrong here? 我在这里做错什么了吗? If so how can I fix it?
如果可以,我该如何解决?
Javascript you are running keeps outputting the same data that has been sent when the page loaded. 您正在运行的Javascript始终输出与加载页面时发送的数据相同的数据。 Thus it never change, as it is not reading from server.
因此它永远不会改变,因为它不是从服务器读取的。
You would need to use ajax to re-read data from server whenever needed to update. 每当需要更新时,您将需要使用ajax从服务器重新读取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.