function dir_path($path) {
$path = str_replace('\\', '/', $path);
if(substr($path, -1) != '/') $path = $path . '/';
return $path;
}
//文件目录,查询后缀,返回的数组,去除的后缀
function dir_list($path, $exts = '', $list = array(),$no_exts='') {
$path = dir_path($path);
$files = glob($path . '*');
foreach($files as $v) {
if ((!$exts && !$no_exts) || ($exts && preg_match("/\.($exts)/i", $v)) || (!$exts && $no_exts && !preg_match("/\.($no_exts)/i", $v))) {
!is_dir($v) && $list[] = $v;//去除目录
if (is_dir($v)) {
$list = dir_list($v, $exts, $list,$no_exts);
}
}
}
return $list;
}
01-19
02-18
291