2 回答

TA貢獻(xiàn)2019條經(jīng)驗(yàn) 獲得超9個(gè)贊
只需循環(huán)訪問您的數(shù)據(jù)并呈現(xiàn)它
$data = [];
foreach ($databaseResult as $row) {
$data[$row['name']][] = $row;
}
foreach($data as $name => $stuff) {
echo $name . '<br>';
foreach($stuff as $row) {
echo $row["title"] . ':' . $row["content"] . '<BR>';
}
}

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊
可以使用前循環(huán)。例如:
foreach($yourarrayvariable as $data)
{
echo "<tr>";
echo "<td class='heading'>".$data['name']."</td>";
echo "<div class='content'>";
echo "<td>".$data['title']."</td>";
echo "<td>".$data['content']."</td>";
echo "</div>";
echo "</tr>";
}
并根據(jù)需要在foreach中創(chuàng)建所需的模板外觀類。
- 2 回答
- 0 關(guān)注
- 105 瀏覽
添加回答
舉報(bào)