//搜索文件夹下全部文件,暂时不支持中文文件名
public function scanFile($path) {
if (!is_dir($path))
return array();
// 兼容各操作系统
$path = rtrim(str_replace('\\','/',$path ),'/').'/';
$result = array();
$files = scandir($path);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
$file=iconv("gb2312","utf-8",$file);
if (is_dir($path . '/' . $file)) {
$result = array_merge($result, scanFile($path . '/' . $file));
} else {
$result[] = basename($file);
}
}
}
return $result;
}
PHP搜索文件夹下全部文件
猜你喜欢
转载自blog.csdn.net/w13707470416/article/details/85562571
今日推荐
周排行