用递归。static function test($arr){foreach($arr as $key => $value){ if(is_array($value)&&empty($value)){ unset($key); }else{ class::test($value); }}}