Progress display in PHP loop and "false"

Source: Internet
Author: User
In the PHP loop, the progress is displayed and & quot; false dead & quot; theoretically, the program should run 500 times before it is displayed as successful, however, basically only a dozen times can be run, and the page starts to be completely white (and the Mark loaded on the page disappears), so we will not continue to execute the program. how can we solve this problem, thank you. In addition, I don't know how to handle the progress. Thanks again for the progress in the & lt PHP loop and "false"
In theory, the program should run 500 times before it is displayed as successful, but the page starts to be completely white (and the loaded mark in the webpage also disappears ), the program will no longer be executed.
How can I solve this problem? thank you.

In addition, I do not know how to handle the progress. Thanks again


 For ($ I = 1; I I <500; $ I ++ ){
File_put_contents ("polici=.txt", $ I );
Sleep (3 );
$ S = $ I/100;
If ($ s = ceil ($ s )){
$ S = $ I/500;
Echo "progress: {$ s}
";
}
}
Echo "OK ";
?>
Share:
------ Solution --------------------
3 seconds × 500 = how long?

Not Dead
------ Solution --------------------
Set_time_limit
------ Solution --------------------
Php is a computing output. even if it is computed and output in the same way as CLI, you need to constantly screen to achieve the progress bar effect.
The progress is displayed on the client. you think php will be computed on the server-> displayed on the client-> ...... So?

If you want this effect, you need to split the loop. the client receives the first data, ajax sends the next request to the server, php calculates the next data, and sends the result to the client, ajax on the client ......

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.