Home > php教程 > php手册 > body text

分享php程序执行进度

WBOY
Release: 2016-06-07 11:38:16
Original
1235 people have browsed it

程序执行的进度,按照百分比计算


测试php——flush



完成度。。。





ob_start();
ob_implicit_flush(1);

function OutLing() {
echo "完成度。。。
";
echo "
\n";
echo "\n";
}

function SetLingData($I) {
echo "<script>doload(" . $I . ")</script>";
ob_flush();
flush();
}

//想办法让这个代码可以正常的把进度跑起来!

//OutLing();
ob_end_flush();
//ie 需要接受256个字节后才开始显示
echo str_pad(" ", 1024);
$max = 50000;
For ($j = 0; $j $plan = round($j/$max*100, 2);
SetLingData($plan);
/*if ($j != 500) {
sleep(1); //让程序"睡"一秒钟,会让你把效果看得更清楚
}*/
}
?>

测试展示出来

附件 新建文件夹.rar ( 947 B 下载:101 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template