以下のJSON文字列がjson_decode()
に渡され、NULL
が返されます。json_decode - NULLを返す
$homeJSON = file_get_contents("http://strategy-bets.com/archive/archive.php?baseurl=http://www.totalcorner.com".$Home_Team_Link);
$homeJSON = str_replace("\xEF\xBB\xBF",'',$homeJSON);
$homeJSON = rtrim($homeJSON);
$homeJSON = html_entity_decode($homeJSON);
$homeJSON = preg_replace('/\s+/', '', $homeJSON);
$clean = rtrim($homeJSON, "\x00..\x1F");
$home_decoded = json_decode($clean);
$home_decoded
はまだNULL
です:
{"total_goals":26,"total_games":17,"average_goals":"1.53"}
は、ここに私のコードです。
$ Home_Team_linkは何ですか? –
@Abitnewそれはこの文脈で本当に重要ではありません。 JSONの例は '{" total_goals ":26、" total_games ":17、" average_goals ":" 1.53 "}' – CMS
は '$ clean'のjsonですか? – Jeff