Home > Backend Development > PHP Tutorial > Analysis of ob_flush function and flush function usage in PHP, ob_flushflush_PHP tutorial

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:02:47
Original
1012 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:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template