2 个解决方案
#1
看看这个事实,你就知道该怎么做了
$a = array(
0 => array('name' => 1),
5 => array('name' => 2),
6 => array('name' => 3),
);
echo json_encode($a); //{"0":{"name":1},"5":{"name":2},"6":{"name":3}}
echo json_encode(array_values($a)); //[{"name":1},{"name":2},{"name":3}]
#2
哇咔咔~~~多谢啊~解决啦~
#1
看看这个事实,你就知道该怎么做了
$a = array(
0 => array('name' => 1),
5 => array('name' => 2),
6 => array('name' => 3),
);
echo json_encode($a); //{"0":{"name":1},"5":{"name":2},"6":{"name":3}}
echo json_encode(array_values($a)); //[{"name":1},{"name":2},{"name":3}]
#2
哇咔咔~~~多谢啊~解决啦~