Php nginx is a simple implementation method for real-time output.
The method for enabling real-time output in PHP is ob_implicit_flush (),
However, it does not work in most cases,
In the php. ini configuration, most output_buffering output buffering is enabled On,
Zlib. output_compression is also frequently enabled,
In addition to the PHP layer, Nginx buffer settings proxy_buffering and gzip compression are also enabled.
For the sake of one or two pages, I am afraid no one will make this choice to modify the website configuration of the entire server.
Here we recommend a simple method:
Set_time_limit (0); ob_end_clean (); ob_implicit_flush (); header ('x-Accel-Buffering: no'); // the key is to add this line. Echo 'here is :'. date ('H: I: s '). '<br>'; sleep (5); echo 'after five seconds :'. date ('H: I: s ');
Summary
The above is a simple implementation method of php nginx real-time output introduced by xiaobian. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in time!