php输出缓冲问题!

来源:互联网 发布:amazon s3 阿里云 编辑:程序博客网 时间:2024/04/30 17:04

 

for ($i = 0;$i < 100;$i++){ if ($i % 2 == 0) {  echo("已执行了<font color=red><strong>" . $i . "</strong></font>条<br/>");  sleep(1);  ob_flush();  flush(); }}


以上代码需要嵌入到,有标准HTML代码的页面去!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body></body></html>