PHP Tutorial Web Effects Dynamic display of the server running Program progress bar
if (' source ' = = $_get[' act ') {//View source code
Show_source ($_server["Script_filename"]);
Exit
}//end If
Set_time_limit (0);
for ($i = 0; $i <; $i + +) {
$users [] = ' tom_ '. $i;
}//end for
$width = 500; Displayed progress bar length, Unit px
$total = count ($users); Total number of records that need to be manipulated
$pix = $width/$total; Progress bar unit length for each record's operation
$progress = 0; Current progress bar Length
?>
<title></title>
PX ">
The dynamic effect of the following progress bar is generated by the server-side PHP program combined with the client Web effects program.
PX ">
0%
Flush (); Send the output to the client browser
foreach ($users as $user) {
The use of empty loops to simulate more time-consuming operations, which need to be replaced in the actual application;
If your operation is not time consuming, I think you will not need to use this script:)
for ($i = 0; $i < 10000; $i + +) {
;;
}
?>
Flush (); A JavaScript program that sends output to the client browser so that it can execute server-side outputs immediately.
$progress + = $pix;
}//end foreach
Finally, the progress bar is set to the maximum value $width, and the operation is completed.
?>
Flush ();
?>
http://www.bkjia.com/PHPjc/444882.html www.bkjia.com true http://www.bkjia.com/PHPjc/444882.html techarticle PHP Tutorial Web effects Dynamic display of the server running Program progress bar if (' source ' = = $_get[' act ') {//View source code Show_source ($_server[script_filename]); exit;}//e nd if set_ ...