时间:2021-07-01 10:21:17 帮助过:9人阅读
<?php /* * json */ $books = array('key1'=>'value1','key2'=>'value2','key3'=>array('key4'=>'value4','key5'=>'value5')); $json = json_encode($books); $rejson = json_decode($json,true); echo '原数组:
'; print_r($books); echo '
'; echo '经json编码后:
'; print $json."
"; echo '
'; echo '经json解码后:
'; print_r($rejson); echo '
'; //实例 $jsonn = '{"error_code":"400","request":"\/Router\/aQConnectError","api_code":40006,"error":"\u4f20\u5165\u7684\u63a5\u53e3\u53c2\u6570\u51fa\u9519\uff0c\u53c2\u6570openid\u672a\u8bbe\u5b9a\u3002"}'; print_r(json_decode($jsonn)); ?>
希望本文所述对大家的php程序设计有所帮助。