我正在使用 readdir 创建照片库,在该目录中也有非图像文件。目录中有数千个文件,我真的很难过滤扩展名。任何帮助将不胜感激
if ($handle = opendir(getcwd())) {
while (false !== ($entry = readdir($handle))) {
//but there are other files like doc,pdf,html,php how to fiter them
echo "<img src='$entry' height='100' width='100'>";
}
closedir($handle);
}