代码问题疑惑
<?php
//打开指定目录
function readDrectory($path){
$handle=opendir($path);
while (($item=readdir($handle))!==false) {
//.和..这两个特殊目录
if ($item!="."&&$item="..") {
if (is_file($path."/".$item)) {
$arr['file'][]=$item;
}
if (is_file($path."/".$item)) {
$arr['dir'][]=$item;
}
}
}
closedir($handle);
return $arr;
}
$path="uploads";
print_r(readDrectory($path));
?>
运行后提示:
Notice: Undefined variable: arr in D:\phpStudy\WWW\Thehome\upfile\dir.func.php on line 17