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 "}}"
JSON
Share to: more
------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));