日期:2014-05-17 浏览次数:20424 次
$d = array( 0 => array( 'a' => string 'Days_3' (length=6) 'b' => string '3 Days' (length=6) ) 1 => array( 'a' => string 'Days_7' (length=6) 'b' => string '7 Days' (length=6) ) 2 => array( 'a' => string 'Days_14' (length=7) 'b' => string '14 Days' (length=7) ) 3 => array( 'a' => string 'Days_30' (length=7) 'b' => string '30 Days' (length=7) ) 4 => array( 'a' => string 'Days_60' (length=7) 'b' => string '60 Days' (length=7) )); foreach($d as $v) { echo ltrim($v['a'],"Days_").","; }
$ch = ''; foreach($d as $v) { echo $ch . ltrim($v['a'],"Days_"); $ch = ','; }
------解决方案--------------------
substr($str,0,-1)或者放入数组中。再用implode连接