我似乎在使用自举轮播在for循环中显示图像时遇到了问题
<?php
$message = "";
if(empty($_GET['id'])) {
$session->message("<div class='btn sm-warning'>please select an image.</div>");
redirect_to('list_properties.php');
}
$id = $_GET['id'];
$sql = "SELECT * FROM pictures2 WHERE photograph_id='$id';";
$photos = Picture::find_by_sql($sql);
?>
for循环不显示图像并且目录没有错误,请问有什么办法可以解决吗?
<div id="carouselExampleIndicators" class="carousel slide mx-auto" data-ride="carousel">
<ol class="carousel-indicators">
<?php
$i = 0;
for ($a = 2; $a < count($photos); $a++):
?>
<li data-target="#carouselExampleIndicators" data-slide-to="<?php echo $i; ?>" class="<?php echo $i == 0 ? 'active': ''; ?>"></li>
<?php
$i++;
endfor;
?>
</ol>
<div class="carousel-inner">
<?php
$i = 0;
for ($a = 2; $a < count($photos); $a++):
?>
<div class="carousel-item <?php echo $i == 0 ? 'active': ''; ?>">
<?php
$imageUrl = "images/".$photos['image'][$a];
?>
<img src="<?php echo $imageUrl; ?>" class="img-thumbnail img-responsive" alt=""/>
</div>
<?php
$i++;
endfor;
?>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>