简体   繁体   English

一段时间后,PHP页面变为空白

[英]PHP page going blank after sometime of time out

I have set my PHP page to refresh and get values from the database , the problem is that it goes blank after sometimes. 我已将我的PHP页面设置为刷新并从数据库中获取值,问题是有时后它变为空白。 The refreshing part and everything works fine. 令人耳目一新的部分,一切正常。 Only thing is that the page goes blank 唯一的是页面空白

Code i used for refreshing the page is: 我用于刷新页面的代码是:

$url=$_SERVER['REQUEST_URI'];
header("Refresh: 1; URL=$url")

Place an iframe which calls your page to refresh inside a static page. 放置一个iframe来调用您的页面以在静态页面内刷新。 Then refresh this iframe every second. 然后每秒刷新一次该iframe。 Using this pattern it breaks not the functionality when the dynamic page returns blank once. 使用此模式,当动态页面一次返回空白时,它不会破坏功能。

Simple Example 简单的例子

<html>

<script>
    setInterval("reload()", 2000);

    function reload(){
         document.getElementById('refresh').src = "./page_to_refresh.php";
    }
</script>

<iframe id="refresh" src="./page_to_refresh.php">
</html>

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

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