【发布时间】:2018-04-23 15:36:51
【问题描述】:
我有以下 JSON 表
[
["TITLE", "CONTENT", "DATE"],
["Monday", "Content of the monday post goes here", "09:55\n10:00\n10:30\n11:00\n15:45"],
["Tuesday", "Content of the tuesday day goes here", "08:00\n11:00\n16:00\n16:00\n21:00\n"],
]
我使用foreach 来获取json 的内容
$days = json_decode(file_get_contents('json_file'));
foreach($days as $item){
if(isset($item)){
$firstColumn = $item;
}
echo $firstColumn[0];
};
$firstColumn[0] 返回“标题”、“星期一”、“星期五”
如何将其添加到表格中?
<table class="table">
<thead>
<tr>
<th> Title </th>
<th>Content</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
【问题讨论】:
标签: php json html-table