Home >Backend Development >PHP Tutorial >PHP uses flush() ob_flush() to output strings one by one_PHP tutorial

PHP uses flush() ob_flush() to output strings one by one_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:55:481133browse

In the past, js was used to instantiate chat rooms or non-refresh output. In fact, php can be implemented separately. In php, we can use flush() ob_flush().

ob_end_clean(); //Clear the output cache and close the cache
echo str_pad(' ',256);//Output 256 bytes of space (under the IE browser, more than 256 bytes must be accepted before the output is displayed
)

echo '
abc___'.$i;
The code is as follows
 代码如下 复制代码
for($i=0;$i<5;$i++){

echo '
abc___'.$i;
flush();
ob_flush();
sleep(1);
}
Copy code

for($i=0;$i< 5;$i++){
flush(); ob_flush();

sleep(1);

} This method is not available under Opera because the Opera browser does not output content before encountering an html tag
http://www.bkjia.com/PHPjc/631645.htmlwww.bkjia.com
truehttp: //www.bkjia.com/PHPjc/631645.htmlTechArticleIn the past, js was used to instantiate chat rooms or non-refresh output. In fact, php can be implemented separately. In php We can use flush() ob_flush(). ob_end_clean(); //Clear the output cache...
Statement:
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