PHP设置进度条的方法

yipeiwu_com5年前PHP代码库

本文实例讲述了PHP设置进度条的方法。分享给大家供大家参考。具体如下:

<html>
<head>
<style type="text/css"><!--
div {
 margin: 1px;
 height: 20px;
 padding: 1px;
 border: 1px solid #000;
 width: 275px;
 background: #fff;
 color: #000;
 float: left;
 clear: right;
 top: 38px;
 z-index: 9
}
.percents {
 background: #FFF;
 border: 1px solid #CCC;
 margin: 1px;
 height: 20px;
 position:absolute;
 width:275px;
 z-index:10;
 left: 10px;
 top: 38px;
 text-align: center;
}
.blocks {
 background: #EEE;
 border: 1px solid #CCC;
 margin: 1px;
 height: 20px;
 width: 10px;
 position: absolute;
 z-index:11;
 left: 12px;
 top: 38px;
 filter: alpha(opacity=50);
 -moz-opacity: 0.5;
 opacity: 0.5;
 -khtml-opacity: .5
}
-->
</style>
</head>
<body>
<?php
if (ob_get_level() == 0) {
  ob_start();
}
echo str_pad('Loading... ',4096)."<br />\n";
for ($i = 0; $i < 25; $i++) {
  $d = $d + 11;
  $m=$d+10;
  //This div will show loading percents
  echo '<div class="percents">' . $i*4 . '% complete</div>';
  //This div will show progress bar
  echo '<div class="blocks" style="left: '.$d.'px"> </div>';
  flush();
  ob_flush();
  sleep(1);
}
ob_end_flush();
?>
<div class="percents" style="z-index:12">Done.</div>
</body>
</html>

希望本文所述对大家的php程序设计有所帮助。

相关文章

PHP使用new StdClass()创建空对象的方法分析

本文实例讲述了PHP使用new StdClass()创建空对象的方法。分享给大家供大家参考,具体如下: PHP可以用 $object = new StdClass(); 创建一个没有成员...

PHP中strpos、strstr和stripos、stristr函数分析

本文为大家分析了 PHP中strpos、strstr和stripos、stristr函数,供大家参考,具体内容如下 strpos mixed strpos ( string $hayst...

php !function_exists(&quot;T7FC56270E7A70FA81A5935B72EACBE29&quot;))代码解密

复制代码 代码如下: < ?php if (!function_exists("T7FC56270E7A70FA81A5935B72EACBE29")) { function T7...

CURL的学习和应用(附多线程实现)

CURL的学习和应用(附多线程实现)

curl安装:windows下面的安装:修改php.ini文件的设置,找到php_curl.dll//取消下在的注释extension=php_curl.dll linux下面安装:复制...

crontab无法执行php的解决方法

本文分析了crontab无法执行php的解决方法。分享给大家供大家参考,具体如下: 用crontab跑php程序时,如何去调试,各人有各人的方法。我也有套方法,看一下,我是如何解决cro...