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 ......