The address for copying the code is: fr2.php. netmanualhfunction. ob-flush.php #109314 my code is as follows, after execution is not displayed line by line, but waited for a long time, came out together: {code ...} OS: Macosx10.9webservice: nginx1.4p... the address where I copied the code is: http://fr2.php.net/manual/zh/function.ob-flush.php#109314
My code is as follows. After execution, it is not displayed line by line, but after a long time, it appears together:
header('Content-type:text/html; charset=utf-8');if (ob_get_level() == 0) ob_start();for ($i = 0; $i<10; $i++){ echo "
Line to show."; echo str_pad(' ',4096)."\n"; ob_flush(); flush(); sleep(2);}echo "Done.";ob_end_flush();
OS: Mac osx 10.9
Webservice: nginx 1.4
Php 5.6
Reply content:
The address where I copied the code is: http://fr2.php.net/manual/zh/function.ob-flush.php#109314
My code is as follows. After execution, it is not displayed line by line, but after a long time, it appears together:
header('Content-type:text/html; charset=utf-8');if (ob_get_level() == 0) ob_start();for ($i = 0; $i<10; $i++){ echo "
Line to show."; echo str_pad(' ',4096)."\n"; ob_flush(); flush(); sleep(2);}echo "Done.";ob_end_flush();
OS: Mac osx 10.9
Webservice: nginx 1.4
Php 5.6
There is no problem with running.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show.
Line to show. Done.
PHP version too high
If the value of the ob_get_level () function is 0, the output buffer is not enabled if the value is 0. My ob_get_level () returns 1.
Note:flushAndob_flushDifferences:
ob_flushThe operation isphpIts ownbuffer
flushThe operation isapacheOfflushThat is to say, this pairnginxIs ineffective
In nginx, try the following settings:
Fastcgi_max_temp_file_size 0 # disable the disk buffer fastcgi_buffers 1 1 1 k # Set the buffer to a small value
Edit php. ini, set output_buffering = 0 to disable the buffering mechanism, and restart the server.