我有一个 php echo,我想为 width 属性使用一个变量以避免需要 if 语句。我尝试使用此代码:
<?php echo variable; ?>
没用。
这是我的代码:
echo "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='25' aria-valuemin='0' aria-valuemax='100' style='width: (Variable)'>";
最佳答案
这行吗:
echo "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='25' aria-valuemin='0' aria-valuemax='100' style='width: ".$variable."'>";
关于样式(宽度)属性中的php变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19229915/