PHP数组转JSON

PHP数组转JSON

php数组转json

$array = Array('a'=>'one01', 'b'=>'two01', 'c'=>'three01');
echo json_encode( $array );

结果输出

{"a":"one01","b":"two01","c":"three01"}

php json转数组

$json= {"a":"one01","b":"two01","c":"three01"}
echo json_decode( $json );

结果输出

Array('a'=>'one01', 'b'=>'two01', 'c'=>'three01');

Copyright: 采用 知识共享署名4.0 国际许可协议进行许可

Links: https://qingjiaqi.com/2020/09/05/php数组转json

Buy me a cup of coffee ☕.