1. 服务器双动力的
nginx/conf 下的nginx.conf 里面
关掉
gzip off;
fastcgi_keep_conn on;
加入上面两句。
在/www/wdlinux/phps/53/etc/php.ini
在这里面关掉
output_buffering = off
上面这句。
都重启服务试一下。
2. 可用的代码:
<?php
header('Content-Type: text/html; charset=utf-8');
// I think maybe you can set output_buffering using ini_set here, but I'm not sure.
// It didn't work for me the first time at least, but now it does sometimes…
// So I set output_buffering to Off in my php.ini,
// which normally, on Linux, you can find at the following location: /etc/php5/apache2/php.ini
@ini_set('output_buffering','Off');
@ini_set('zlib.output_compression',0);
@ini_set('implicit_flush',1);
@ob_end_clean();
set_time_limit(0);
ob_start();
echo str_repeat(' ',1024*8); //<– For some reason it now even works without this, in Firefox at least or in Safari ?
//ob_flush();
//ob_implicit_flush();
//ob_flush();
//flush();
for($j = 1; $j <= 20; $j++) {
echo "->";
ob_flush();
//flush();
echo $j." ";
sleep(1);
}
?>
echo str_repeat(' ',1024*8); //<– For some reason it now even works without this, in Firefox at least or in Safari ?
上面这个是重点。 有些浏览器不好使, 就要用这个。
我的mac上就是不行。 后为加了这句的代码就可以了。
原创, 转发留地址。
有些技巧性的东西,还是理论的东西不了解