WDlinux官方论坛's Archiver

pifire 发表于 2016-7-30 13:28

output_buffering

wdcp v2 ,php 3.17 ,apache+nginx并用,php.in output_buffering=4096;

程序代码:

ob_end_clean();
ob_implicit_flush(1);
$buffer = ini_get('output_buffering');
echo str_repeat(' ',$buffer+1);

for ($i=10; $i>0; $i--) {
        echo $i;
        flush();
        sleep(1);
}
echo $buffer;
exit();

php程序无法逐行输出,请问是什么机制?

公司的其他apache服务器没有问题,能够逐行输出.

admin 发表于 2016-7-31 22:58

把output_buffering关了试试

pifire 发表于 2016-8-3 17:35

终于解决了:header('X-Accel-Buffering: no'); 以前没有用过

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.