顾城imooc
2015-08-08 12:46
Array ( [dir] => Array ( [0] => file/. [1] => file/.. [2] => file/abc [3] => file/imooc1 ) [file] => Array ( [0] => file/2.jpg [1] => file/file.func.php [2] => file/imooc.txt [3] => file/imoocnew_3424a2ff04.txt [4] => file/imoocnew_91e0f5ffbe.txt [5] => file/imooc_php.txt [6] => file/test.html [7] => file/test123.txt ) )
function readDirectory($dirname){
$dir_handle = opendir($dirname);
while( ($file = readdir($dir_handle)) !==false){
$dirFile = $dirname.'/'.$file;
if($dirFile!="." && $dirFile!=".."){
if(is_file($dirFile))
$arr ['file'][] = $dirFile;
if(is_dir($dirFile))
$arr ['dir'][] = $dirFile;
}
}
closedir($dir_handle);
return $arr;
}
$path = "file";
print_r(readDirectory($path));
?>
WEB在线文件管理器
36223 学习 · 332 问题
相似问题
回答 1
回答 2