如何在浏览器中实时输出php结果?

时间:2015-08-14 10:59:17

标签: php buffer

我已创建此代码,它每秒显示下一个整数,但输出也有错误。

<?php

ob_implicit_flush();
for ($i = 0; $i < 30; $i++) {
  echo "-> $i <br>\n";
  ob_end_flush();
  ob_end_clean();
  sleep(1);
}

?>

错误:

Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in c:\apache\www\TEST.PHP on line 6
Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in C:\apache\www\TEST.PHP on line 7
-> 4

在ob_ *函数上放置@符号以消除这些错误也会禁用实时输出。

0 个答案:

没有答案