json_encode 出来的字符串只有花括号{}没有中括号[]

2025-04-25 17:56:40
推荐回答(1个)
回答1:

字母索引的数组的就是花括号,数字索引才是中括号,比如:

$arr = array(array('a'=>1,'b'=>2),array('c'=>3));
echo json_encode($arr);// hi-docs.com/php/json_encode.html