PHP 进度条函数的简单实例 PHP 进度条函数的简单实例 其实进度条的做法很简单的。网上的一大堆,自己写了一个,哈哈,感觉看起来很有感觉。 实例代码: function ShowPercent($now,$total) { $percent = sprintf('%.0f',$now*100/$total); $html = ''; $count=0; $pertr = 30; while($count < $total) { $bgcolor = $count < $now ? 'green':'#EEEEEE'; $html .= ''; $count++; if($count%$pertr == 0) $html .= ''; } $bgcolor2 = $now == $total ? ' style="font-weight:bold;color:green;"':''; $html .= ''.$percent.'%
'; return $html; } 效果截图: 100%的时候。 如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!