Why do I need `str_pad('',4096)` to make PHP flushing work?
问题 For example, this doesn't work (Firefox 21, IE8): <?php function flush_buffers(){ ob_end_flush(); ob_flush(); flush(); ob_start(); } ob_start(); echo 'Text 1<br />'; flush_buffers(); Sleep(2); echo 'Text 2<br />'; flush_buffers(); Sleep(2); echo 'Text 3<br />'; flush_buffers(); Sleep(2); echo 'Text 4<br />'; ?> But this one works: <?php function flush_buffers(){ echo str_pad('',4096); ob_end_flush(); ob_flush(); flush(); ob_start(); } ob_start(); echo 'Text 1<br />'; flush_buffers(); Sleep(2)