The progress bar is the computer in the processing of tasks, real-time, in the form of pictures to show the speed of processing tasks, completion, the amount of remaining unfinished tasks, and may need to process time, usually in a rectangular bar display. This article mainly introduced the PHP implementation of the progress bar effect, combined with an example of the PHP dynamic display percentage of the progress bar function, involving PHP cache, mathematical operations and JavaScript page elements dynamic operation related skills, the need for friends can refer to, specific as follows:
<?php//Prevents execution timeout set_time_limit (0),//clears and closes output cache Ob_end_clean (),//data needs to be cycled for ($i = 0; $i < 188; $i + +) {$users [] = ' tom_ '. $i;} The length of the calculated data $total = count ($users);//Display the progress bar length, unit px $width = 500;//per record of the progress bar unit length $pix = $width/$total;//default starting progress bar percentage $ progress = 0;? >