1 回答
TA贡献1820条经验 获得超2个赞
作为示例(样式并根据需要添加)
$cars[] = ['name' => 'HRV',
'price' => 'CAD-$23300',
'img' => 'http://direct.automobiles.honda.com/images/2016/hr-v/exterior-gallery-new/2016-honda-hrv-front-view.jpg',
'desc' => 'HRV is a mini suv made by Honda',
];
$cars[] = ['name' => 'CHR' ,
'price' => 'CAD-$23675' ,
'img' => 'https://d1bxbrgbmu84na.cloudfront.net/wp-content/uploads/2019/08/16093812/CHR.jpg' ,
'desc' => 'RDX is a large SUV made by Acura' ,
];
echo '<h1>My favourite Cars</h1>';
foreach ($cars as $detail) {
echo '<h2>' . $detail['name'] . '<p>' .
$detail['price'] . '<p>' .
$detail['desc'] . '<br>' .
'<img src=' . $detail['img'] . '</p></h2>';
}
- 1 回答
- 0 关注
- 149 浏览
添加回答
举报