php中ob_flush函数和flush函数用法分析,ob_flushflush_PHP教程

WBOY
Release: 2016-07-13 10:02:47
Original
918 people have browsed it

php中ob_flush函数和flush函数用法分析,ob_flushflush

本文实例分析了php中ob_flush函数和flush函数用法。分享给大家供大家参考。具体如下:

ob_flush()函数: 取出PHP buffering中的数据,放入server buffering

flush()函数: 取出Server buffering的数据,放入browser buffering

例如代码:

<&#63;php 
  echo str_repeat('m0sh1' ,1000);   
  for($i=0;$i<4;$i++) { 
    echo $i.'<br />'; 
    ob_flush(); 
    flush(); 
    sleep(1); 
  } 
&#63;> 
<&#63;php 
//header("content-type:text/html;charset='utf-8'"); 
//提示错误Cannot modify header information - headers already sent by 
&#63;>
Copy after login

执行发现

这里代码输出结果是一行一行输出的,

注意:正确使用二者的顺序是. 先ob_flush, 然后flush

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/969496.htmlTechArticlephp中ob_flush函数和flush函数用法分析,ob_flushflush 本文实例分析了php中ob_flush函数和flush函数用法。分享给大家供大家参考。具体如下: ob_f...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!