首页 > 代码库 > implode 多维数组转一维数组并字符串输出

implode 多维数组转一维数组并字符串输出

    //多维数组返回一维数组,拼接字符串输出
    public function r_implode( $glue, $pieces ) 
    { 
       foreach( $pieces as $r_pieces ) 
       { 
         if( is_array( $r_pieces ) ) { 
           $retVal[] = self::r_implode( $glue, $r_pieces ); 
         } else { 
           $retVal[] = $r_pieces; 
         } 
       } 
       return implode( $glue, $retVal ); 
     } 

 

implode 多维数组转一维数组并字符串输出