php自定义函数: 遍历文件夹及其子文件夹

来源:互联网 发布:wow插件mac 编辑:程序博客网 时间:2024/06/07 16:56
function traverse_folder($path = '.') {    $current_dir = opendir($path);    while(($file = readdir($current_dir)) !== false) {        $sub_dir = $path . DIRECTORY_SEPARATOR . $file;        if($file == '.' || $file == '..') {            continue;        } else if(is_dir($sub_dir)) {            traverse_folder($sub_dir);        } else {            //......        }    }}

0 0
原创粉丝点击