PHP JS Dynamic Display server running program progress bar _php Tutorial

Source: Internet
Author: User
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_ ...

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