For those who just learned
1. Flush: Refresh the contents of the buffer and output.
Function format: flush()
This function appeared in PHP3. It is a very efficient function. It has a very useful function of refreshing the browser's cache. Let's give an example of the operation effect. A very obvious example to illustrate the PHP function flush().
Example 2.
<ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php </span></span></li><li><span>for($</span><span class="attribute">i</span><span> = </span><span class="attribute-value">1</span><span>; $i </span><span class="tag"><</span><span>= 300; $i++ ) print(“ “); </span></li><li class="alt"><span>// 这一句话非常关键,cache的结构<br />使得它的内容只有达到一定的大小才能从浏览器里输出 </span></li><li><span>// 换言之,如果cache的内容不达到<br />一定的大小,它是不会在程序执行完毕前输出的。经 </span></li><li class="alt"><span>// 过测试,我发现这个大小的底限是<br />256个字符长。这意味着cache以后接收的内容都会 </span></li><li><span>// 源源不断的被发送出去。 </span></li><li class="alt"><span>For($</span><span class="attribute">j</span><span> = </span><span class="attribute-value">1</span><span>; $j </span><span class="tag"><</span><span>= 20; $j++) { </span></li><li><span>echo $j.” </span></li><li class="alt"><span>”; </span></li><li><span>flush(); //这一部会使cache新增的内容<br />被挤出去,显示到浏览器上 </span></li><li class="alt"><span>sleep(1); //让程序“睡”一秒钟,会让<br />你把效果看得更清楚 </span></li><li><span>} </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>
The latest PHP chat room for PHP2000 is This technology is used, but unfortunately the source code is not made public. Note: If you add ob_implicit_flush() to the beginning of the program to turn on absolute refresh, you can no longer use the PHP function flush() in the program. The benefit of this is: improved efficiency!