Home  >  Article  >  php教程  >  php的json_encode函数问题,phpjson_encode函数

php的json_encode函数问题,phpjson_encode函数

WBOY
WBOYOriginal
2016-06-13 08:49:411393browse

php的json_encode函数问题,phpjson_encode函数

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn