PHP 进度条函数,很不错的!自己写的
2012-12-23 22:17
113 查看
其实进度条的做法很简单的。网上的一大堆,自己写了一个,哈哈,感觉看起来很有感觉。
效果截图: 100%的时候。
function ShowPercent($now,$total) { $percent = sprintf('%.0f',$now*100/$total); $html = '<table width="60%" style="border-collapse:separate" height="10" border="0" cellpadding="0" cellspacing="2" bgcolor="#fff"><tr>'; $count=0; $pertr = 30; while($count < $total) { $bgcolor = $count < $now ? 'green':'#EEEEEE'; $html .= '<td bgcolor="'.$bgcolor.'"> </td>'; $count++; if($count%$pertr == 0) $html .= '</tr><tr>'; } $bgcolor2 = $now == $total ? ' style="font-weight:bold;color:green;"':''; $html .= '<td'.$bgcolor2.' colspan="'.($count%$pertr).'">'.$percent.'%</td></tr></table>'; return $html; }
效果截图: 100%的时候。
相关文章推荐
- 自己抽象的J2ME进度条
- 用 Composer构建自己的 PHP 框架之构建路由
- 记第二次使用php开发项目之绝不重复自己
- 自己独立配置wamp的php开发环境
- 利用 Composer 一步一步构建自己的 PHP 框架(二)——构建路由
- 很不错的PHP随机字符串的代码
- 自己动手设计 PHP MVC 框架(一)——URL
- xser php framework => a simple php5 framework => 色色自己的PHP框架
- 编写自己的PHP MVC框架笔记
- 编写自己的PHP MVC框架笔记
- php实现文件上传进度条
- 用PHP生成自己的LOG文件
- CI 框架 404 跳转到自己的controller 分类: 地址传参 地址重写 php CI框架 2014-03-26 10:58 413人阅读 评论(0) 收藏
- PHP持续保有长连接,利用flush()持续更新浏览器UI,下载进度条实现
- PHP利用apc实现上传进度条方法
- 分享工作与学习PHP过程中的心得,不断提升自己
- 自己动手和php-fpm通讯
- 自己写的php木马webshell扫描器
- 搭建自己的Wiki ,用于发布进度和自己的工作心得
- phpexcel-自己写的几个非常好用的函数