- $buffer = ini_get('output_buffering');
- echo str_repeat(' ',$buffer+1); //防止浏览器缓存
- ob_end_flush(); //关闭缓存
- for( $i=1; $i<=10; $i++ ){
- echo '第 '.$i.' 次输出.'."<br />\\n";
- flush(); //刷新缓存(直接发送到浏览器)
- sleep(1);
- }
- echo '输出完毕!';
- //该片段来自于http://www.codesnippet.cn/detail/250620134252.html
来源: http://www.codesnippet.cn/detail/250620134252.html