$arr 变量报错 未定义 求解答
$arr 变量报错 未定义 求解答
function readDirectory($path){
$handle = opendir($path);
while ($item = readdir($handle)!==false) {
if ($item != "."&&$item!="..") {
if (is_file($path."/".$item)) {
$arr['file'][] = $item;
global $arr;
}elseif (is_dir($path."/".$item)) {
$arr['dir'][] = $item;
global $arr;
}
}
}
closedir($handle);
return $arr;
}
$path = "../file";
print_r(readDirectory($path));