Solution when flush ()-based output cannot be in sequence _ PHP Tutorial

Source: Internet
Author: User
The solution based on flush () cannot be output in sequence. In linux, first confirm whether to add ob_start () and ob_flush (). copy the code as follows: ob_start (); for ($ i1; $ i10; $ I ++) {echo $ I. brn; ob_flush (); flush (); usl in linux, first check whether ob_start () and ob_flush () are added ().

The code is as follows:


Ob_start ();
For ($ I = 1; $ I <= 10; $ I ++ ){
Echo $ I ."
\ N ";
Ob_flush ();
Flush ();
Usleep (500000 );
}


If the output is still unavailable, add the header information before the code.

The code is as follows:


Header ("Content-Type: text/html; charset = utf8 ;");
Ob_start ();
For ($ I = 1; $ I <= 10; $ I ++ ){
Echo $ I ."
\ N ";
Ob_flush ();
Flush ();
Usleep (500000 );
}

First, check whether ob_start () and ob_flush () are added (). the code is as follows: ob_start (); for ($ I = 1; $ I = 10; $ I ++) {echo $ I. "br/\ n"; ob_flush (); flush (); usl...

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.