日期:2014-05-17 浏览次数:20500 次
$s="{SUCESS=[ttt,111],ERROR=[rrr,ggg,vd]}"; preg_replace('/(\w+)=\[(.*?)\]/e','$ar[$1]=explode(",","$2")',$s); print_r($ar); /* Array ( [SUCESS] => Array ( [0] => ttt [1] => 111 ) [ERROR] => Array ( [0] => rrr [1] => ggg [2] => vd ) ) */