1,"3123123"=>1,"221112"=0);怎么转成json类数组格式啊,如下:谢谢PHP code$output = [msg,{"tel"">
时间:2021-07-01 10:21:17 帮助过:21人阅读
$input = array("13546465"=>1,"3123123"=>1,"221112"=0);
$output = [msg,{"tel":"13546465","status":"1"},{"tel":"3123123","status":"1"},{"tel":"221112","status":"0"}]
$input = array("13546465"=>1,"3123123"=>1,"221112"=>0); $r[] = 'msg'; foreach($input as $k=>$v) $r[] = array('tel' => "$k", 'status' => "$v"); $output = json_encode($r); echo $output;