Questions about json parsing in php

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.