He intentado buscar como arreglar esto en Google pero no encuentro el porqué el código está mal. Estoy intentando hacer que lea cada archivo json
y que se vean todos los juegos del array.
El fallo que recibo es:
Fatal error: Cannot use object of type stdClass as array in the "file name"
Este es el código:
<?php
$file = file_get_contents("a file in json");
$info = json_decode($lista);
$game = $info['game'];
$game_list = $game['file'];
foreach($game_list as $i){
echo $i;
}
?>
{
"Status": true,
"Game": {
"max": 60,
"list":["league","bns","vindi"]
},
"Version": "1.8.8"
}
here is the json file:
{
"Status": true,
"Game": {
"max": 60,
"list":["league","bns","vindi"]
},
"Version": "1.8.8"
}
true
aquí:$info = json_decode($lista,TRUE);