【发布时间】:2014-04-29 16:39:19
【问题描述】:
我正在尝试在我的网站上发布更新 ping,而不是一直重新加载它,但是当我尝试发布初始 ping 时,它不会在我设置的时间间隔后更新
index.php:
<script>
setInterval(document.write('<?php echo json_encode(getPingout());?>'),100);
</script>
functions.php:
<?php
function getPingout() {
// some function that finds the ping of the server
return $server->getPing();
}
?>
【问题讨论】:
-
了解页面生命周期。
-
致选择正确答案的模组:w3schools.com?说真的,对于这个关于堆栈溢出的家伙,没有比参考网络开发的伏地魔更好的解释了吗?
标签: javascript php variables combinations setinterval