日期:2014-05-17 浏览次数:20623 次
function get_dir( $a, $s = 0, $d = array( '.', '..' ), $f = array() ) { foreach ( scandir( $a ) as $g ) { if ( !in_array( $g, $d ) ) { $g = $a . '/' . $g; if ( $s > 0 && is_dir( $g ) ) { ( $s == 1 || $s > 3 || ( $s == 2 && count( scandir( $g ) ) == 2 ) ) && $f[] = $g . '/'; $s > 1 && $s < 6 && $f = get_dir( $g, $s, $d, $f ); } else { ( ( $s && $s < 5 ) || ( !$s && is_file( $g ) ) ) && $f[] = $g; }; }; }; return $f; }