有趣的事

PHP递归遍历目录下指定的文件

Get all file match $pattern.

function glob_recursive($pattern, $flags = 0) {
 $files = glob($pattern, $flags);
 foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
  $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
 }
 return $files;
}

相关阅读