PHP遍歷文件夾下全部文件

<?php
function getAllFiles($path){
    foreach(scandir($path) as $file){
        if($file === '.'|| $file === '..') continue;
        if(is_dir($path.'/'.$file)) getAllFiles($path.'/'.$file);
        else echo $path.'/'.$file."\n";
    }
}
getAllFiles('/Users/sam/test');
?>
相關文章
相關標籤/搜索