<?php 
//遍历一个文件下的所有文件夹和子文件夹

$dir = '../bootstrap-3.3.7-dist';

function showdir($dir){
    $arr = array();
    if($hd = opendir($dir)){
        while($file = readdir($hd)){
            if($file !== '..' && $file !== '.'){
                if(is_dir($dir.'/'.$file)){
                    $arr[$file] = showdir($dir.'/'.$file);
                }else{
                    $arr[] = $file;
                }
            }
        }
    }
    closedir($hd);
    return $arr;
}

print_r(showdir($dir));

?>