【发布时间】:2022-01-08 11:20:13
【问题描述】:
我有一个问题,或者更确切地说是我一直在互联网上研究如何放置进度条的问题。他们都使用样式方法给出百分比。 如果有人可以支持我,我想在我的 php 代码中添加一个进度条。我会很感激的。
正如您在图片中看到的我的总时间百分比,它已经显示了百分比。现在我想用进度条显示该百分比。
我试图展示它,但它只需要我一张记录。
<br><br>
<div class="barra">
<div class="progreso"><div class="porcentaje"></div></div>
</div>
<script type="text/javascript">
document.getElementsByClassName("progreso")[0].style.width = "<?php echo $porcentaje; ?>%";
document.getElementsByClassName("porcentaje")[0].innerHTML = "<?php echo $porcentaje; ?>%";
</script>
<?php
@ob_flush();
flush();
$total = substr($user->finish, 0, 4) -substr($user->start, 0, 4) + 1;
$current = substr($user->diasf, 0, 4);
$porcentaje = ($current/$total) * 100;
$porcentaje = round($porcentaje, 0);
?>
<?php
@ob_flush();
flush();
usleep(500);?>
<thead>
<th style=""; class="button-3"> Persona Asignada</th>
<th style=""; class="button-4"> Tarea</th>
<th style=""; class="button-3">Descripcion</th>
<th style=""; class="button-3">Dias Asignados</th>
<th style=""; class="button-3">Dia Finalizado</th>
<th style=""; class="button-3">% Total tiempo</th>
</thead>
<?php
foreach($users as $user){
?>
<tr>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->persona, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->title, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->description, 0, 200);; ?></td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->finish, 0, 200)-substr($user->start, 0, 200) + 1;; ?> Dias</td>
<td class="bg-info text-white" style="color:#070001"><?php echo substr($user->diasf, 0, 200);; ?> Dias</td>
<td class="bg-info text-white" style="color:#070001">
<?php
$total = substr($user->finish, 0, 4) -substr($user->start, 0, 4) + 1;
$current = substr($user->diasf, 0, 4);
$percent = ($current/$total) * 100;
$percent = round($percent, 0);
// echo "$current es $percent% of $total.
// <p />";
?>
【问题讨论】:
-
来自javascript tag info:“[JavaScript] 与 Java 编程语言无关,只有表面上的相似之处。...”