Php ob_flush function and flush function usage analysis, ob_flushflush_PHP tutorial

Source: Internet
Author: User
Usage analysis of ob_flush and flush functions in php, ob_flushflush. Php ob_flush function and flush function usage analysis, ob_flushflush This article analyzes the usage of the ob_flush function and flush function in php. Share it with you for your reference. Details: ob_flush function and flush function usage analysis in ob_f php, ob_flushflush

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

Ob_flush () function: extracts data from PHP buffering and places the data in server buffering.

Flush () function: extract the data of Server buffering and put it into browser buffering.

Example code:

<? Php echo str_repeat ('m0sh1', 1000); for ($ I = 0; $ I <4; $ I ++) {echo $ I .'
'; Ob_flush (); flush (); sleep (1) ;}?> <? Php // header ("content-type: text/html; charset = 'utf-8'"); // The error Cannot modify header information-headers already sent by?>

Execution discovery

Here, the code output result is output in one row,

Note: the correct sequence of use is: first ob_flush, then flush

I hope this article will help you with php programming.

In this article, we analyze the usage of the ob_flush function and flush function in php. Share it with you for your reference. Details: ob_f...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.