1 回答
TA贡献1815条经验 获得超12个赞
这是如何呈现 html 的示例。使用以下选项,您可以按照您想要的方式更改几乎每个类别。
<div class="owl-carousel owl-theme owl-loaded">
<div class="owl-stage-outer">
<div class="owl-stage">
<div class="owl-item">...</div>
<div class="owl-item">...</div>
<div class="owl-item">...</div>
</div>
</div>
</div>
while循环将显示数据库中的所有图像,直到您不限制查询,因此,您不需要指定每个图像。
while 循环中的 php 代码应如下所示:
<div class="owl-carousel owl-theme owl-loaded">
<div class="owl-stage-outer">
<div class="owl-stage">
<?php while($row = mysqli_fetch_assoc($select_operator_one_strat)){ ?>
<div class="owl-item">
<img src="path-to-image/<?php echo $row['image-name']; ?>" />
</div>
<?php }?>
</div>
</div>
</div>
但是您正在尝试显示特定图像,因此您的代码应该如下所示,无需 while 循环:
<div class="owl-carousel owl-theme owl-loaded">
<div class="owl-stage-outer">
<div class="owl-stage">
<?php $row = mysqli_fetch_assoc($select_operator_one_strat);?>
<div class="owl-item">
<img src="path-to-image/<?php echo $row['image-1']; ?>" />
</div>
<div class="owl-item">
<img src="path-to-image/<?php echo $row['image-2']; ?>" />
</div>
<div class="owl-item">
<img src="path-to-image/<?php echo $row['image-3']; ?>" />
</div>
<div class="owl-item">
<img src="path-to-image/<?php echo $row['image-4']; ?>" />
</div>
</div>
</div>
</div>
- 1 回答
- 0 关注
- 84 浏览
添加回答
举报