时间:2021-07-01 10:21:17 帮助过:5人阅读
PHP 进度条函数的简单实例
其实进度条的做法很简单的。网上的一大堆,自己写了一个,哈哈,感觉看起来很有感觉。
实例代码:
- 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%的时候。
相关推荐:
jquery网页加载进度条实现方法
HTML5 Ajax文件上传进度条如何显示
Ajax 实现加载进度条的方法
以上就是关于PHP 进度条函数的简单实例的详细内容,更多请关注Gxl网其它相关文章!