readDirectory这函数有问题
function readDirectory($path) { $arr = array();//必须先声明,目录为空不进入while循环,$arr就不存在,会出现错误 $handle = opendir ( $path ); while ( ($item = readdir ( $handle )) !== false ) { //.和..这2个特殊目录 if ($item != "." && $item != "..") { if (is_file ( $path . "/" . $item )) { $arr ['file'] [] = $item; } if (is_dir ( $path . "/" . $item )) { $arr ['dir'] [] = $item; } } } closedir ( $handle ); return $arr; }
问题和解决方法看第二行