我正在尝试将我的变量放入一个或多个数组中,然后循环它们
<!DOCTYPE html>
<html>
<style>
html {
background-color: bisque;
}
h1 {
display: block;
text-align: center;
}
h2 {
display: block;
text-align: center;
color: saddlebrown;
}
img {
border-radius: 50%;
width: 800px;
text-align: center;
}
p {
text-align: center;
color: saddlebrown;
}
</style>
<head>
<meta charset="UTF-8">
<title>Dynamic web pages with PHP</title>
</head>
<body>
<header>
<nav id="main-navigation">
</nav>
</header>
<?php
$Cartitle = "My favourite Cars";
$Carname = "HRV";
$Carprice = "CAD-$23300";
$Carimg = "http://direct.automobiles.honda.com/images/2016/hr-v/exterior-gallery-new/2016-honda-hrv-front-view.jpg";
$Cardescription = "HRV is a mini suv made by Honda";
$Carname2 = "CHR";
$Carprice2 = "CAD-$23675";
$Carimg2 = "https://d1bxbrgbmu84na.cloudfront.net/wp-content/uploads/2019/08/16093812/CHR.jpg";
$Cardescription2 = "HRV is a mini suv made by Toyota";
$Carname3 = "RDX";
$Carprice3 = "CAD-$43990";
$Carimg3 = "https://www.acura.ca/Content/acura.ca/e270f141-7f67-4fe2-99bd-e808e3c3c2d7/MediumSizedFeature/03_rdx19_overview_MediumFeature_mobile.jpg";
$Cardescription3 = "RDX is a large SUV made by Acura";
?>
<?php
echo "<h1>$Cartitle<h2>$Carname <p>$Carprice <p> $Cardescription <br> <img src=$Carimg></p></h2><h1><br>";
echo "<h2>$Carname2 <p>$Carprice2 <p> $Cardescription2 <br> <img src=$Carimg2></p></h2><br>";
echo "<h2>$Carname3 <p>$Carprice3 <p> $Cardescription3 <br> <img src=$Carimg3></p></h2>";
?>
</body>
</html>
DIEA