Aspire

遍历目录

发布时间:4年前热度: 4222 ℃评论数:

function searchDir($path,&$files){

if(is_dir($path)){

  $opendir = opendir($path);

  while ($file = readdir($opendir)){

if($file != '.' && $file != '..'){

  searchDir($path.'/'.$file, $files);

}

  }

  closedir($opendir);

}

if(!is_dir($path)){

  $files[] = $path;

}

  }

//得到目录名

function getDir($dir){

$files = array();

searchDir($dir, $files);

return $files;

}


源码安装、技术讨论、二次开发等联系微信:

目录

栏目导航

  1. PHP
  2. Go
  3. Mysql
  4. Linux
  5. 前端
  6. 杂谈

手机扫码访问