0

这段代码对我来说很好

 $input= '{"remoteRef":"RM4","competitionName":"Calgary 2012 - IVF World Sprint Champs","venue":"Calgary, Canada","startDate":"2012-08-11T00:00.00","finishDate":"2012-08-11T00:00.00","races":[{"remoteRef":"1001-0010303","raceNo":"216","eventName":"Adaptive Mixed - V6 500","roundName":"St. Final","roundNo":1,"roundCount":1,"scheduledStart":"2012-08-13T13:36.00","actualStart":"2012-08-13T14:28.08","isFinal":true,"lanes":[{"laneNo":"1","teamName":"Hawaii # 2","clubName":"Hawai\u0027i","placing":"3","officialTime":"3:00.58","officialTimeMs":86580580},{"laneNo":"2","teamName":"Rio Va´a","clubName":"Brazil","placing":"2","officialTime":"2:46.66","officialTimeMs":86566660},{"laneNo":"3","teamName":"Hawaii # 1","clubName":"Hawai\u0027i","placing":"1","officialTime":"2:46.43","officialTimeMs":86566430}],"raceState":"RESULT"}]}';

 $json = json_decode($input);

 var_dump($json);

但是当我将相同的数据发布到我的网站并使用下面的代码时。我收到一个 json 解码错误 JSON_ERROR_UTF8

$input = file_get_contents('php://input');

$json = json_decode($input);

var_dump($json);

任何想法我可能做错了什么来得到 JSON_ERROR_UTF8 错误?

4

1 回答 1

0

在发布之前尝试base64编码并在获取后解码..

于 2012-08-13T23:35:38.727 回答