自定义模板,格式化输出数据

Original 2019-02-20 17:12:53 294
abstract:$arr = [    [ 'id' => 1, 'name' => '王宝强', 'balance' => 122.86],    ['id' => 3, 'name' => 

$arr = [

    [ 'id' => 1, 'name' => '王宝强', 'balance' => 122.86],

    ['id' => 3, 'name' => '黄晓明', 'balance' => 151.86],

    [ 'id' => 4, 'name' => '井柏然', 'balance' => 811.00],

    ['id' => 5, 'name' => '鹿晗', 'balance' => 151.86],

    ['id' => 6, 'name' => '成龙', 'balance' => 1013.98],

]

$rows = [];

foreach($arr as $row){

    $rows[] = $row;

}


<table>

<caption>用户信息表</caption>

<tr>

<th>ID</th>

<th>姓名</th>

<th>存款(元)</th>

</tr>


<?php foreach ($rows as $row) : ?>


<tr>

<td><?php echo $row['id'] ?></td>

<td><?php echo $row['name'] ?></td>

<td><?php echo $row['balance'] ?></td>

</tr>


<?php endforeach; ?>


</table>


Correcting teacher:韦小宝Correction time:2019-02-20 17:18:38
Teacher's summary:整体来说写的还是算是不错的 这就是模拟的数据的渲染啊

Release Notes

Popular Entries