Ask for advice. php parses json. This post was last edited by easeyoo from 2014-01-1623: 15: 20. for advice, the json data returned by the website is as follows: {& nbsp; & nbsp; "dataList": & nbsp; [& nbsp; & nbs tutorial, php json parsing problem
This post was finally edited by easeyoo at 23:15:20. please kindly advise that the json data returned by the website is as follows:
{
"DataList ":[
{
"Subject": "Here is the title ",
"Distance": "Distance ",
"Address": "Qingdao city, Shandong province"
},
{
"Subject": "Here is the title ",
"Distance": "Distance ",
"Address": "Qingdao city, Shandong province"
}
]
}
On the other end, php is used. the following code is used to obtain the data, but no data is obtained. the code is as follows:
Url = 'http: // www.123.com/query_json.php? Action = ceshi & x = 1 ';
$ Response = ihttp_get ($ url); // ihttp_get is an encapsulated function that submits URLs without any problems
$ Content = $ response ['content'];
$ D = json_decode ($ content, true );
$ Traces = $ traces ['datalist'];
Foreach ($ traces as $ trace ){
$ Reply. = "{$ trace ['subobject']}-{$ trace ['address']} \ n ";
}
Return $ this-> respText ($ reply );
}
Return $ this-> respText ($ text );
?>
In this case, the result cannot be output. respText is an encapsulated class. it is mainly because an engine returns data to the user. ask how to obtain the data returned by json. thank you.
Share: More