【发布时间】:2016-05-08 01:24:55
【问题描述】:
我希望有人可以帮助我解决这个问题。我使用 codeigniter 作为我的框架。在我的一个观点中,我想输出与数据库中“bestoutof”列中的数字一样多的选项卡。我试过的代码是:
<?php for ($x = 1; $x = $post->bestoutof; $x++) {
echo '<div class="tab-pane fade active in" id="game<?php $post->bestoutof; ?>"></div>'; } ?>
但它似乎不起作用。非常感谢您对此提供任何帮助。
谢谢!
【问题讨论】:
-
它有什么作用?有什么错误吗? $post->bestoutof 的值是多少?
-
$x = $post->bestoutof; ???。如果“bestoutof”不是 1,则不会执行循环。使用 $x bestoutof;
-
@Peter $post->bestoutof 的价值是多少?
标签: php html codeigniter loops for-loop