【发布时间】:2021-04-08 13:20:07
【问题描述】:
当显示数据库中的数据时,我想自动为每一行编号。像这样的
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
根据数据库中可用的数据,每行按从 1 到 n 的升序编号。我该如何正确地做到这一点。任何帮助请是 laravel 的新手
【问题讨论】:
-
计数器怎么样
-
请问你能帮我吗?