foreach( $_gcid as $_gc ){
//$_gci = count($_gcid)-1; $_gcid['gcid'] .= $_gc['name'].',';

}麻烦PHP大虾帮我改改

解决方案 »

  1.   

    <?php$array = array('lastname', 'email', 'phone');
    $comma_separated = implode(",", $array);echo $comma_separated; // lastname,email,phone?> 
      

  2.   


    +++++++++++++就implode好了,效率高
      

  3.   

    $string = implode("," $_gcid);
    echo $string;
      

  4.   


    foreach( $_gcid as $_gc ){
                                //$_gci = count($_gcid)-1;                            $_gcid['gcid'] .= $_gc['name'].',';
                                
                            }
    rtrim(',', $_gcid['gcid']);
      

  5.   

    $_gc = array(1,2,3);
    $g= implode(',',$hao);
    echo $g;
      

  6.   

    foreach( $_gcid as $_gc ){
       $_gcid['gcid'] .= $_gc['name'].',';
    }
    $_gcid['gcid'] = substr($_gcid['gcid'], 0, -1);或
    foreach( $_gcid as $_gc ){
       $_g[] = $_gc['name'];
    }
    $_gcid['gcid'] = join(',', $_g);