首页 >php教程 >php手册 >php的json_encode函数问题

php的json_encode函数问题

WBOY
WBOY原创
2016-07-06 13:30:491298浏览

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"}


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn