欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

php的json_encode函数问题

程序员文章站 2022-05-13 12:09:19
...

php的json_encode函数问题: $ary = []; $ary[0] = 'a'; $ary[1] = 'b'; echo json_encode($ary) . 'br'; echo json_encode($ary, JSON_FORCE_OBJECT); 结果: ["a","b"] {"0":"a","1":"b"}

php的json_encode函数问题:

$ary = [];
$ary[0] = 'a';
$ary[1] = 'b';
echo json_encode($ary) . '
';
echo json_encode($ary, JSON_FORCE_OBJECT);

结果:

["a","b"]
{"0":"a","1":"b"}