function file_list($path){
$im_type=array('bmp','jpg','jpeg','png','gif'); //初始化图片文件扩展名
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path."/".$file)) {
//echo $path.": ".$file."<br>";//去掉此行显示的是所有的非目录文件
file_list($path."/".$file);
} else {
if(strpos($file,'.png',1)||strpos($file,'.jpg',1)||strpos($file,'.ico',1)||strpos($file,'.gif',1)){
echo '<img src="'.$path.'/'.$file.'" />';
}
}
}
}
}
}
.表示当前目录,..表示上一级目录,在 LINUX下.和..都是文件的形式
温馨提示:答案为网友推荐,仅供参考
第1个回答 2011-03-08
意思就是 如果 $file 不等于"."和".." 的时候
第2个回答 2011-03-08
判断$file变量 不等于 . 和 .. 时
第3个回答 2011-03-08
如果变量$file不是.并且不是..执行后面语句
应该用来判断目录的
应该用来判断目录的