//php 获取当前目录下的所有文件,需要用递归处理,这边需要注意的是:这边用到了引用传递,而不是 返回值, 引用传递达标百度查看用法即可
public function folder_name($filePath,&$myfolders){
$handle = opendir(iconv("UTF-8","gb2312",$filePath));//打开文件夹
$folder = [];
foreach(scandir(iconv('UTF-8','gb2312',$filePath)) as $file){
if($file == '.' || $file == '..'){
continue;
}
$file=iconv('GB2312', 'UTF-8', $file);
$filePath1 = $filePath .'/'.$file;
if(filetype(iconv("UTF-8","gb2312",$filePath1)) == 'dir'){
$folder[] = $filePath .'/'.$file;
$myfolders[] = $filePath .'/'.$file;
$this->folder_name($filePath1,$myfolders);
}
}
}