PHP以二维数组显示图像

PHP以二维数组显示图像,php,arrays,Php,Arrays,我需要帮助以循环方式显示一组图像。我似乎找不到显示图像的正确路径。这是我的数组: $images = array(); $images[22] = array("id"=>22,"title" => "View of Cologne", "description" => "View of Cologne from atop the Cologne Cathedral", "country" => "Germany", "user" => "João Fernande

我需要帮助以循环方式显示一组图像。我似乎找不到显示图像的正确路径。这是我的数组:

$images = array();
$images[22] = array("id"=>22,"title" => "View of Cologne", "description" => "View of Cologne from atop the Cologne Cathedral", "country" => "Germany", "user" => "João Fernandes", "path" => "6114850721.jpg");
$images[54] = array("id"=>54,"title" => "Arch of Septimus Severus", "description" => "In the Roman Forum", "country" => "Italy", "user" => "Ellie Sullivan", "path" => "9495574327.jpg");
$images[7] = array("id"=>7,"title" => "Lunenburg Port", "description" => "On board a small sailing ship leaving Lunenburg", "country" => "Canada", "user" => "Mark Taylor", "path" => "5856697109.jpg");
$images[19] = array("id"=>19,"title" => "British Museum", "description" => "The library in the British Museum in London", "country" => "United Kingdom", "user" => "Mark Taylor", "path" => "5855729828.jpg");

$images[46] = array("id"=>46,"title" => "Temple of Hephaistos", "description" => "Located on western perimeter of Agora in Athens. Built in 460-415 BCE, it is the best preserved temple of antiquity.", "country" => "Greece", "user" => "Ellie Sullivan", "path" => "8711645510.jpg");
$images[6] = array("id"=>6,"title" => "At the top of Sulpher Mountain", "description" => "At top of Sulpher Mountain near Banff", "country" => "Canada", "user" => "Frantisek Wichterlová", "path" => "6114907897.jpg");


?>
这些图像存储在本地PHP工作区中名为travel的文件中。在数组中循环、获取“路径”并显示该图像的正确方法是什么


谢谢你

你应该这样使用foreach:

foreach ($images as $image) {
    echo $image['path'];

}
没有什么难以置信的:

$basepath = './travel/';
foreach ($images as $image) {
    printf('<img src="%s"/>', $basepath . $image['path']);
}
$basepath='./travel/;
foreach($images作为$image){
printf(“”,$basepath.$image['path']);
}

我假设图像存储在名为“travel”的文件夹中是否正确?是否要输出HTML?