function searchDir($path,&$data){
    //目录
    if(is_dir($path)){
        $dp=dir($path);
        while(($file=$dp->read()) !== false){
            if($file!='.'&& $file!='..'){
                searchDir($path.'/'.$file,$data);//递归调用
            }
        }
        $dp->close();
    }
    //文件
    if(is_file($path)){
        $data[]=$path;
    }
}
function getDir($dir){
    $data=array();
    searchDir($dir,$data);
    return   $data;
}

print_r(getDir('.'));

 

相关文章:

  • 2022-12-23
  • 2021-12-28
  • 2021-09-18
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-01-07
  • 2022-12-23
相关资源
相似解决方案