JSON data returned, empty after Json_decode
Http://zhidao.baidu.com/link?url=kEYMQrLi41ZyC3Yo5XoN_QEbUentL2yVvcUg3seg_ZVksV2w5KBMudlQomrizXZiEoe3Uz0xtp7Moj9nRLBLNK
I have the same problem as him.
Call the app interface, and then PHP accepts the return JSON string (well-formed after validation): The returned data does not match the actual character (three characters more),
And then change the PHP to a JSON header or not.
The app returns:
String (121) "? {"ErrorCode": "0", "errormsg": "Success", "ResponseData": {"UID": "$", "Sender_uid": "PNs", "Error": "0", "error_msg": " Success "}}"
Json_decode->null
Copied to the file:
String (118) "{" ErrorCode ":" 0 "," errormsg ":" Success "," ResponseData ": {" UID ":" $ "," Sender_uid ":" PNs "," Error ":" 0 "," Error_msg ":" Success "}}"
------Solution--------------------
BOM Header reasons for it
------Solution--------------------
More than three characters are BOM head, remove on it can be
For example, if received in the $s, then
$a = Json_decode (substr ($s, 3));
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