This article will share with you how to read json data code in PHP. The code is very short. I hope it can help everyone.
<?php $json = "{'a':'1','b':'2','c':'abcdefg'}"; vardump(json_decode($json)); vardump(json_decode($json,true));
Note: If the true parameter is not added, an object will be output, and if the true parameter is added, it will be output in the form of an array
Related recommendations:
NodeJs Precautions when reading JSON file format
php remote Analysis of the method of reading json
php performance issues in reading json files
The above is the detailed content of How to read json data code in php. For more information, please follow other related articles on the PHP Chinese website!