This article mainly introduces the PHP flush invalid, IIS7 PHP real-time output method, the need for friends can refer to the next
In a more time-consuming operation, I want to display the operation record in realtime on the browser and use Flush () to send the contents of the buffer to the browser. But in the IIS7 in the fastcgi mode configuration of PHP can not be implemented, the results are always displayed together.
for ($i =10; $i >0; $i-) { echo $i. ' <br/> '; @ob_flush (); Flush (); Sleep (1);}
The above code is not able to gradually display the results under IIS default settings. The solution is as follows:
Open file C:\Windows\System32\inetsrv\config\applicationHost.config, note If you are a 64-bit system, this file must be opened with 64-bit editing software, 32-bit software open will prompt the file does not exist , you can use the system's own Notepad notepad to open it. Find the following paragraph, add the red code on the line, that is, PHP this handler inside add responsebufferlimit= "0".
The code is as follows:
Now you can try it, if it doesn't work, put php.ini inside the output_buffering = Off.
The last point of the
is important, and there are different results in the browser. IE inside should be no problem, if it is with chrome, each echo out of the content must have HTML, otherwise it is not, and if the echo content is too short to achieve this effect, you can first output a space before the code, such as: Echo Str_pad (", 1050); Chrome seems to have to output more than 1000 characters to have this effect, no words to try.