Analysis of ob_flush function and flush function usage in PHP, ob_flushflush_PHP tutorial

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

Analysis of usage of ob_flush function and flush function in php, ob_flushflush

This article analyzes the usage of ob_flush function and flush function in php with examples. Share it with everyone for your reference. The details are as follows:

ob_flush() function: Take out the data in PHP buffering and put it into server buffering

flush() function: Take out the data from Server buffering and put it into browser buffering

Example code:

<&#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

Perform Discovery

The output result of this code is output line by line,

Note: The correct order to use the two is. First ob_flush, then flush

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969496.htmlTechArticleAnalysis of ob_flush function and flush function usage in php, ob_flushflush This article analyzes the ob_flush function and flush function usage in php with examples. Share it with everyone for your reference. The details are as follows: 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!