遍历一个文件夹及子文件夹,返回所有符合指定**正则条件**的完整文件路径名

 function  getFilePath($path,$str='/\*\*正则条件\*\*/'){
    $handle = opendir($path);
    while(($item=readdir($handle)) != false){
      if($item!="."&&$item!=".."){
        if(preg_match($str,filename($item))){
          $result[] = filename($item);
        }
      }
    }
    return $result;
  }

 

posted @ 2016-11-09 09:17  zeoo  阅读(552)  评论(0编辑  收藏  举报