Use of the Ob_flush () function and the flush () function in PHP

Source: Internet
Author: User
This article mainly introduces PHP Ob_flush function and flush function usage, the example analyzes the function of Ob_flush function and flush function and related use skill, has certain reference value, the need friend can refer to the next

This paper analyzes the usage of Ob_flush function and flush function in PHP. Share to everyone for your reference. Specific as follows:

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

Flush () Function: Remove the data from the server buffering and put it into browser buffering

For example, code:

<?php   Echo str_repeat (' m0sh1 ', +);     for ($i =0; $i <4; $i + +) {     echo $i. ' <br/> ';     Ob_flush ();     Flush ();     Sleep (1);   } ?> <?php//header ("content-type:text/html;charset= ' Utf-8 '"); Hint error cannot modify header Information-headers already sent by?>

Perform discovery

Here the code output is one line of output,

Note: The order in which they are used correctly is. Ob_flush first, then flush.

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.