Json data is returned, and json_decode is left blank

Source: Internet
Author: User
Json data is returned. after json_decode, it is null zhidao. baidu. comlink? Callback: The problem I encountered is similar to that of calling the app interface. then, php accepts and returns the jso json data. after json_decode, it is null.
Http://zhidao.baidu.com/link? Url = response

The problem I encountered is similar to that of him.

Call the app interface, and then php accepts the returned json string (the format is correct after verification): the returned data is inconsistent with the actual characters (three more characters ),
Change the php end to a json header or not
Returned by the app:
String (121 )"? {"ErrorCode": "0", "errorMsg": "success", "responseData": {"uid": "36", "sender_uid": "37 ", "error": "0", "error_msg": "success "}}"
Json_decode-> NULL
Copy to File:
String (118) "{" errorCode ":" 0 "," errorMsg ":" success "," responseData ": {" uid ":" 36 "," sender_uid ": "37", "error": "0", "error_msg": "success "}}"

Json

Share: More


------ Solution --------------------
Why is the BOM header?
------ Solution --------------------
The BOM header contains three more characters. you can remove it.
For example, if the received value is in $ s
$ A = json_decode (substr ($ s, 3 ));

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.