【发布时间】:2017-05-24 06:07:47
【问题描述】:
我有一个嵌套的关联数组,可以在表格中打印出用户数据。代码如下:
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Prenume</th>
<th>Nume de familie</th>
<th>Email</th>
<th>Telefon</th>
<th>Oras</th>
<th>Adresa</th>
</tr>
</thead>
<tbody>
<?php foreach ($user_data as $arr){ ?>
<tr>
<td>
row number nedded here
</td>
<?php foreach ($arr as $key => $value){ ?>
<td><?php echo $value; ?></td>
<?php } ?>
</tr>
<?php }?>
</tbody>
</table>
我需要在最左边显示行号,而不是“这里的行号”
【问题讨论】:
-
什么意思是最左边的数字而不是?
-
您的第二次/内部数组迭代显示了您需要做的事情
标签: php arrays key associative-array