所以我了解了 for 循环、do while、foreach,但我只是不知道如何编写代码,因此循环会自动创建我现在手动执行的信息(只需复制和意大利面)
请参阅下面的代码
我的问题:-)如何循环?我可能必须创建一个 Matrix 数组或如何调用 -) 如何将 img 链接包含在数组中并将其插入带有循环的 html 代码中
<?php
// Available, Name , Model, Price, Rent Location,
$car1 = array(
"available" => "Available",
"name" => "Duster",
"model" =>"Nissan",
"price" => 333,
"location" => "Hollywood");
$car2 = array(
"available" => "Available",
"name" => "Panzer",
"model" =>"Bundesheer",
"price" => 98753,
"location" => "Kaserne");
$car3 = array(
"available" => "NOT Available",
"name" => "Hubschrauber",
"model" =>"Pew Pew",
"price" => 98756,
"location" => "Dschungel");
$car4 = array(
"available" => "Available",
"name" => "Schiff",
"model" =>"Öltanker",
"price" => 223123213132,
"location" => "Baltisches Meer");
echo '
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="https://cdn.pixabay.com/photo/2018/09/15/12/33/nissan-3679299_1280.jpg" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">'.$car1["name"]. ' </h5>
<p class="card-text">Model: '.$car1["model"]. '<br> Preis: '.$car1["price"]. '<br>Location: '.$car1["location"]. '</p>
<p class="card-text"><b>'.$car1["available"]. '</b></p>
<a href="#" class="btn btn-primary">Order NOW</a>
</div>
</div>
犯罪嫌疑人X