Home >Backend Development >PHP Tutorial >Related usage methods of php cache output
This article mainly introduces the related usage of PHP cache output. Interested friends can refer to it. I hope it will be helpful to everyone.
The details are as follows:
$buffer = ini_get('output_buffering'); echo str_repeat(' ',$buffer+1); //防止浏览器缓存 ob_end_flush(); //关闭缓存 for( $i=1; $i<=10; $i++ ){ echo '第 '.$i.' 次输出.'."<br />\n"; flush(); //刷新缓存(直接发送到浏览器) sleep(1); } echo '输出完毕!';
The operation effect is as follows:
The first output.
The second output.
The third output.
The 4th output.
The 5th output.
The 6th output.
The 7th output.
The 8th output.
The 9th output.
The 10th output Output times.
Output completed!
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
php smtp method to implement the mail sending function
Implementation of PHP decorator mode Detailed explanation of usage
Detailed explanation of how PHP implements the adapter pattern
The above is the detailed content of Related usage methods of php cache output. For more information, please follow other related articles on the PHP Chinese website!