【发布时间】:2014-04-26 19:26:22
【问题描述】:
我的服务器上存储了图像,即我的服务器上有一个目录,例如: $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] 。 $directory_self 。 'uploaded_files/';
我需要从目录中加载每个图像并显示在以下 html 中:
<div class="image-set">
<a class="example-image-link" href="images/demopage/1.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="images/demopage/1.jpg" alt=""/></a>
<a class="example-image-link" href="images/demopage/2.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="images/demopage/2.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/3.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="images/demopage/3.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/4.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="images/demopage/4.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/5.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="images/demopage/5.jpg" alt=""/></a>
<a class="example-image-link" href="images/demopage/6.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="images/demopage/6.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/7.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="images/demopage/7.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/8.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="images/demopage/8.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/9.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="images/demopage/9.jpg" alt=""/></a>
<a class="example-image-link" href="images/demopage/10.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="images/demopage/10.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/11.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="images/demopage/11.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/12.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="images/demopage/12.jpg" alt="" /></a>
<a class="example-image-link" href="images/demopage/13.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="images/demopage/13.jpg" alt="" /></a>
</div>
img标签可以动态增加,有谁能帮帮我吗?
【问题讨论】:
-
简单循环是什么意思?是的,如果您的意思是我需要显示目录中的所有图像,那么我必须循环所有图像
-
您执行一个循环,为文件夹中的每张图片制作一行 html
-
所以写一些代码来生成html...