此代码适用于我
$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错误?
答案 0 :(得分:0)
在发布之前尝试使用base64编码并在获取后解码..