代码语言:javascript复制
1、方法一
<ul>
<?php
$count = 6;
$complexScore = $model->orderEvaluate->complex_score;
$floorComplexScore = floor($complexScore);
?>
<?php for($i = 1; $i < $count; $i ):?>
<?php if($i <= $floorComplexScore):?>
<li class="evaluate-score-star1"></li>//满星
<?php elseif($complexScore > $i-1): ?>
<li class="evaluate-score-star2"></li>//半星
<?php else:?>
<li class="evaluate-score-star3"></li>//空星
<?php endif; ?>
<?php endfor;?>
</ul>
2、方法二
代码语言:javascript复制<li class="order-last clearfloat">
<?php if($model->orderEvaluate):?>
<ul>
<?= StarWidget::widget(['score' => $model->orderEvaluate->complex_score])?>//传入分数
</ul>
<span><?= $model->orderEvaluate->complex_score;?></span>分//总分
<?php endif; ?>
</li>
<?php endif?>