["arr"]=>
array(2) {
[0]=>
array(1) {
["url"]=>
string(7) "地址1"
}
[1]=>
array(1) {
["url"]=>
string(7) "地址2"
}
}
将二维数组遍历重新组装
foreach ($arr as $val) {
$val = join(",",$val);
$temp_array[] = $val;
}
降维成了一维数组
array(2) {
[0]=>
string(7) "地址1"
[1]=>
string(7) "地址2"
}
PHP自带函数implode()可以将一维数组以指定的间隔方式组装成字符串
$str = implode(",", $temp_array);
组装完成
string(15) "地址1,地址2"