我试图在bootstrap carousel上创建whiles来打印图像。我正在学习。
我得到一个包含数据库网址的数组,而在显示正确的图像时我无法做到。
<?php
$this_post_id = get_the_ID();
$urls =get_post_meta($this_post_id,'my-images', true);
$totalUrls = count($urls);//count urls in array
$number = 0;
?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php while($number <= $totalUrls){ ?>
<li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"></li>
<?php } ?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php while($number <= $totalUrls){
foreach($urls as $url){
?>
<div class="item active">
<img src="<?php echo $url;?>" class="img-responsive" />
<div class="carousel-caption">
...
</div>
</div>
<?php} } ?>
</div>
由于