尝试显示表格中的问题,我想在该问题之前显示序列号。
<?= $index+1 . $form->field($practiceTest, "[$index]question")->textarea(['readonly'=> true]) ?>
任何人都可以提出类似问题后如何显示数字的想法。
例如:1.问题
答案 0 :(得分:1)
如果需要获取计算出的数字,可以尝试使用“顺序列表”。
<ol type="1">
<!-- I guess here you iterate to get index -->
<li>
<?= $form->field($practiceTest, "[$index]question")->textarea(['readonly'=> true]) ?>
</li>
<!-- Finish iteration -->
</ol>
希望这会有所帮助