我将如何显示子文件夹中的所有图像,如下所示: $dir = array('images/posters', 'images/designs', 'images/illustrations'); ??
代码:
<?php
     $dir = 'img/werk/';
     $file_display = array('jpg', 'jpeg', 'png', 'gif');
     if (file_exists($dir) == false) {
         echo 'Directory \'', $dir, '\' not found!';
     } else {
     $dir_content = scandir($dir);
     foreach ($dir_content as $file) {
         $file_type = strtolower(end(explode('.', $file)));
         if ($file !== '.' && $file !== '..' 
                           && in_array($file_type, $file_display) == true) {
             echo '<div class="thing large"><div class="item_description">Item description</div><img src="', $dir, '/', $file, '" /></div>';
         }
       }
     }
?>