I try to decode JSON in PHP To array. This is my code
<?php
$url="file/game.json";
$result_file=file_get_contents($url);
if(!$result_file){ echo 'result_file......Failed'; }
$php_result=json_decode($result_file,true);
print_r($php_result);
if($php_result){
echo 'ok';
}
else{
echo 'error';
}
?>
AND this is my json file
[
{
"name": "ABCD",
"price": "24.36",
"platform": "<span class=\"platform battle-net\"></span>",
"region": "GLOBAL"
},
{
"name": "ABCD",
"price": "27.60",
"platform": "<span class=\"platform xbox-live\"></span>",
"region": "GLOBAL"
}
]
My result Is "error". And I don't no know how to solve this problem.
What should I do.