echo "<META HTTP-EQUIV=REFRESH CONTENT='1;URL=index.php'>";
content后面就是数字秒数,url后填写你要刷新的页面

解决方案 »

  1.   

    哦,对,对;是这样,我想让PHP定时做一些事情,你看应该怎么做?
      

  2.   

    <html>
    <head>
    <META HTTP-EQUIV="Refresh" Content="1;URL=test.php">
    </head>
    <body>
    </body>
    </html>---------------------
    test.php:<html>
    <head>
    CLOCK
    </head>
    <body>
    <?
    echo date("Y年m月d日 H时i分s秒");
    ?>
    </body>
    </html>
      

  3.   

    你看看可不可以这样:
    js不是有定时执行脚本的功能吗,你课以把php代码嵌入js脚本中,试一试看看
    应该可以吧
      

  4.   

    还不太好,我不想让浏览器这样累,只是想在PHP内部实现一个时钟,然后在时钟内部插入其他代码:就像下面的JAVA程序:
    <SCRIPT language=JAVASCRIPT>
    var timerID = null;
    var timerRunning = false;
    function stopclock() 
       {
       if(timerRunning)
         clearTimeout(timerID);
       timerRunning = false;
       }
    function startclock() 
       {
       stopclock();
       showtime();
       }
    function showtime() 
       {
       var now = new Date();
       var hours = now.getHours();
       var minutes = now.getMinutes();
       var seconds = now.getSeconds()
       var timeValue = "" +hours; 
    //定时初始化数据库的代码:   
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
       timeValue += ((seconds < 10) ? ":0" : ":") + seconds
       
       document.Calc.time.value = timeValue;
       // you could replace the above with this
       // and have a clock on the status bar:
       // window.status = timeValue;
       timerID = setTimeout("showtime()",1000);
       timerRunning = true;
       return '';
       }
    </script>
      

  5.   

    to  benjamin9(丢丢):
    应该和在一起吧
      

  6.   

    干吗有PHP,用Javascript实现的不行吗?
      

  7.   

    要想能稳定可靠工作,最好用框架1. 母框架 index.html:<html>
    <head>
    ...
    </head><frameset framespacing=0 frameborder=0 border=0 rows="*,0">
    <frame name=MainFrame scrolling="NO" src="./main.php">
    <frame name=TimeFrame scrolling="NO" noresize src="./time.htm">
    </frameset><noframes>
    <body><p>您的浏览器不支持框架,无法浏览。</p></body>
    </noframes>
    </frameset>2. 主页面 main.php,实现你的主要功能3. 时间控制页面 time.htm,就是一段控制刷新的JS程序<script>
    function Refresh()
    {
       parent.MainFrame.location.reload(true);
       setTime("Refresh()", 1000);
    }
    setTime("Refresh()", 1000);
    </script>怎么样,简单吧?
    关键是控制刷新时间的页面和功能页面要分开,才好定时刷新(欢迎参观俺们的实验田: http://www.twotown.net)
      

  8.   

    应该是合在一起的。
    test.php:
    -----------------------------
    <html>
    <head>
    <META HTTP-EQUIV="Refresh" Content="1;URL=test.php">
    </head>
    <body>
    <?
    echo date("Y年m月d日 H时i分s秒");
    ?>
    </body>
    </html>
      

  9.   

    用刷新隐藏框架的方法更新数据吧,可以作到无刷新显示的。
    隐藏框架内放的是php文件,它输出js代码,
    在隐藏框架内用 parent.object.value=时间字符串 的方式来修改页面上的元素内容
      

  10.   

    刷新框架只要SetTimeout()中反复指定隐藏框架的src就可以了。
      

  11.   

    可以使用sleep();或者usleep()函数
    sleep   暂停执行。
    语法: void sleep(int seconds);
    返回值: 无
    本函数可暂时使程序停止执行。参数 seconds 为要暂停的秒数。usleep    暂停执行。
    语法: void usleep(int micro_seconds);
    返回值: 无
    本函数可暂时使程序停止执行。参数 micro_seconds 为要暂停的毫秒数。可以使用类似于这样的
     while(1){   //do something,
      
      usleep(1000);
           }