Foreach output display, progress issues, experts solve.

Source: Internet
Author: User
Foreach output display, progress issues, experts solve.
$ Citycode = array ("Beijing" => "101010100 ",
"Qingxian" => "101090702 ",
"Cixian" => "101091007 ",
"Chiayi" => "101340901 ",
"Alibaba Cloud" => "101340902 ",
"Yushan" => "101340903 ",
"Xingang" => "101340904"
);
Foreach ($ citycode as $ key => $ value ){

Echo 'output'. $ value .'
';

}
?>


I want to output an array, but there may be a lot of arrays (I want to do some work to generate an array). I want to display one or five arrays slowly. If this is not the case, I have to wait a long time to see the execution result and the execution progress is not displayed.


Reply to discussion (solution)

Add the following statement at the beginning
Ob_start (); // open the output buffer
Ob_end_flush ();
Ob_implicit_flush (1); // output immediately
You can output your output immediately.

The effect is obvious. Thank you for your guidance.

Related Article

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.