php怎么把数组转换成json格式化
展开全部
<?php
$array=array(
"data1"=>"data1",
"data2"=>"data2",
"data3"=>array(
"data11"=>"data11",
"data22"=>"data22",
"data33"=>"data33"
),
"data4"=>array(
"data111",
"data222",
"data333"
)
);
echo json_encode($array);
?>
是不是这个?输出的JSON:
{"data1":"data1","data2":"data2","data3":{"data11":"data11","data22":"data22","data33":"data33"},"data4":["data111","data222","data333"]}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询