字符串:
user:hello,user2:world
期望的输出:
$string = array(
1 => array( 1 => "user", 2 => "hello"),
2 => array( 1 => "user2", 2 => "world")
);
我尝试过的(不起作用):
$string = explode(',',$string);
$string = explode(':',$string);
我得到的错误:explode() expects parameter 2 to be string
如何从字符串获取所需的输出?谢谢!