<?php $dir = "E:照片\"; //打印文件夹中所有jpg文件 function printJpg($dir,$deep = ""){ $dirSource = dir($dir); while($d = $dirSource->read()){ if($d == "." || $d == ".."){ continue; } if(filetype($dir.$d) == "dir"){ printJpg($dir.$d."/",$deep."--"); } if(mime_content_type($dir.$d) == "image/jpeg"){ echo $deep.$d."<br/>"; } } } printJpg($dir);