PHP 字符串转化成数组
发布网友
发布时间:2022-04-06 02:46
我来回答
共1个回答
热心网友
时间:2022-04-06 04:16
<?php
$result = [];
$arr = array('{"parentgroup":"","groupid":"Groups"}', '{"parentgroup":"Groups","groupid":"总裁办"}');
foreach($arr as $key => $value) {
$result[$key] = [];
foreach (json_decode($value) as $k => $v) {
$result[$key][$k] = $v;
}
}
var_mp($result);
?>