在wamp服务器中,除非使用以下功能,否则无法刷新输出缓冲区:
ob_end_flush();
ob_flush();
flush();
ob_start();
为什么我需要使用所有这些功能?为什么简单的ob_flush()
不能工作?我的代码:
<?php
ob_start();
header( 'Content-type: text/html; charset=utf-8' );
echo 'Begin ...<br />';
for( $i = 0 ; $i < 6 ; $i++ )
{
echo $i . '<br />';
sleep(1);
ob_end_flush();
ob_flush();
flush();
ob_start();
}
echo 'End ...<br />';
?>
发布于 2013-02-17 06:41:02
因为默认情况下,参数缓冲 = on
转到C:\wamp\bin\php\php5.4.3\php.ini
找到线
output_buffering = On
并将其改为
;output_buffering = On
https://stackoverflow.com/questions/14922141
复制