2 回答
TA贡献1155条经验 获得超0个赞
您需要foreach()像下面这样申请:-
<?php foreach($array as $arr){?>
<tr>
<?php foreach($arr as $value){?>
<td><?php echo $value;?></td>
<?php } ?>
</tr>
<?php } ?>
所以完整的代码将是:
<table>
<tr>
<th>01.DRPLAPOSTEJ-1</th>
<th>IMPORT</th>
<th>RADM_OK</th>
<th>RADM_REJET</th>
<th>RADM_KO</th>
<th>RPEC_OK</th>
<th>RPEC_REJET</th>
<th>RPEC_KO</th>
<th>FACTU_OK</th>
<th>FACTU_REJET</th>
<th>FACTU_KO</th>
</tr>
<?php foreach($array as $arr){?>
<tr>
<?php foreach($arr as $value){?>
<td><?php echo $value;?></td>
<?php } ?>
</tr>
<?php } ?>
</table>
TA贡献1864条经验 获得超6个赞
您可以将此代码段用于动态标题和数据,
echo "<table>";
$keys = array_keys($arr[0]);
//if you want to make upper cases
$keys = array_map("strtoupper", $keys);
echo "<tr><th>";
echo implode("</th><th>", $keys);
echo "</th></tr>";
foreach ($arr as $key => $value) {
echo "<tr><td>";
echo implode("</td><td>", $value);
echo "</td></tr>";
}
echo "</table>";
- 2 回答
- 0 关注
- 169 浏览
添加回答
举报