上传到服务器时,Bootstrap进度条显示为空

时间:2015-12-01 10:48:41

标签: php html progress-bar

当我上传文件时,有谁知道为什么这些进度条显示为空?我之前使用过它们并且它们工作正常,虽然现在我正在使用数据库中的数据,它们不起作用?

$count1 = 10;
$count2 = 14;
$count3 = 18;
$count4 = 22;

<div class="panel-body">
                       <div class="progress progress-striped">
  <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" value="<? echo $count1; ?>">
    <span class="sr-only">40% Complete (success)</span>
  </div>
</div>
<div class="progress progress-striped">
  <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" value="<? echo $count2; ?>">
    <span class="sr-only">20% Complete</span>
  </div>
</div>
<div class="progress progress-striped">
  <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" value="<? echo $count3; ?>">
    <span class="sr-only">60% Complete (warning)</span>
  </div>
</div>
<div class="progress progress-striped">
  <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" value="<? echo $count4; ?>">
    <span class="sr-only">80% Complete</span>
  </div>
</div>
</div>

2 个答案:

答案 0 :(得分:0)

您似乎错过了div

中的样式宽度属性

尝试替换:

value="<? echo $count2; ?>"> 

使用:

style="width: <? echo $count2; ?>%"

根据您在此处所做的事情,value将无效。

答案 1 :(得分:0)

你也必须设置宽度属性:

<div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="<? echo $count1 ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?= echo $count1 ?>%;">
    <span class="sr-only">60% Complete</span>
  </div>
</div>