首页 > 开发 > PHP > 正文

PHP 进度条函数的简单实例

2024-05-04 22:04:22
字体:
来源:转载
供稿:网友

进度条是很普遍的功能,我们在访问页面的时候都会显示,本文是错新技术频道小编带来的PHP 进度条函数的简单实例,希望能对你学习这方面知识有所帮助。

PHP 进度条函数的简单实例

实例代码:

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%的时候。

上文就是错新技术频道小编介绍的PHP 进度条函数的简单实例,相关的操作实例,在js.VeVb.com为大家继续展现。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表