PHP使用缓存即时输出内容(output buffering)的方法,outputbuffering
PHP使用缓存即时输出内容(output buffering)的方法。分享给大家供大家参考。具体如下:
$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 '输出完毕!';
运行效果如下:
第 1 次输出.
第 2 次输出.
第 3 次输出.
第 4 次输出.
第 5 次输出.
第 6 次输出.
第 7 次输出.
第 8 次输出.
第 9 次输出.
第 10 次输出.
输出完毕!
希望本文所述对大家的php程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.