下面是我以前在本论坛COPY的代码:
<?
$i = 1; 
for($j=0;$j<500;$j++)print(" "); //这一行就是不用刷新页面就能显示的部分,因为浏览器缓冲的原因 for($i;; $i++){ 
if($i%60==0){
print("$i<br>");
flush(); 

sleep(1);
} ?>

解决方案 »

  1.   

    运行不通过
    Fatal error: Maximum execution time of 30 seconds exceeded in e:\inetpub\wwwroot\mychat\flush.php on line 11
      

  2.   

    一个简单的例子,取自.net
    Some sample code:<HTML> 
    <BODY>
    Welkom to chat room:
    <?
    flush();
    while(10==10) // cool while loop 
    {
      // get here som lines from a dbase or so
      // and put in in $tekst   print($tekst);
      flush();
    }
      

  3.   

    另一个例子
    Example of flushing content inside a table with DHTML. Tested in MSIE6.
    Probably works in MSIE5 as well. <html><table border=1><tr><td id=fisk>
    I am inside a table.
    </td></tr></table><? flush(); sleep(2); ?><script>
    document.all.fisk.innerHTML= document.all.fisk.innerHTML + "I am
    still inside a table...";
    </script><? flush(); sleep(2); ?><script>
    document.all.fisk.innerHTML= document.all.fisk.innerHTML +
    "Hehhee....";
    </script></html>