Related usage methods of php cache output

墨辰丷
Release: 2023-03-30 15:40:02
Original
1698 people have browsed it

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 &#39;第 &#39;.$i.&#39; 次输出.&#39;."<br />\n";
  flush(); //刷新缓存(直接发送到浏览器)
  sleep(1);
}
echo &#39;输出完毕!&#39;;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template