码迷,mamicode.com
首页 > 其他好文 > 详细

读取文件内容

时间:2018-01-22 17:30:26      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:return   amp   dir   []   div   post   array   $path   gpo   

function searchDir($path,&$data){
if(is_dir($path)){
$dp=dir($path);
while($file=$dp->read()){
if($file!=‘.‘&& $file!=‘..‘){
$this->searchDir($path.‘/‘.$file,$data);
}
}
$dp->close();
}
if(is_file($path)){
$data[]=$path;
}
}
function getDir($dir){
$data=array();
$this->searchDir($dir,$data);
return $data;
}

调用
$path = $this->getDir($dir);

读取文件内容

标签:return   amp   dir   []   div   post   array   $path   gpo   

原文地址:https://www.cnblogs.com/chenkg/p/8329639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!