duanmiao6695 2016-05-11 13:08
浏览 84
已采纳

如何在表格中显示“while循环”的输出?

I don't even have an idea of where to start for this. I need to display 100 numbers in a table and would like to use a while loop to do so. Is there a "shortcut" to doing this?

  • 写回答

4条回答 默认 最新

  • dsjz1119 2016-05-11 13:13
    关注

    For a table you need some tags table, tr and td. The tr and td are in while loop and the value $i will print inside the td.

    <table>
        <?php
        $i = 1;
        while($i != 101){?>
        <tr><td><?php echo $i++;?></td></tr>
        <?php }?>   
    </table>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?