Help, please, display text from json file:
var_dump($news); string(188994) "{ "Новости":{ "Новость":{ "Категория":"Первая", "Дата":"Сегодня" } } How do I print text from each array like this? echo $news['Категория'];
Help, please, display text from json file:
var_dump($news); string(188994) "{ "Новости":{ "Новость":{ "Категория":"Первая", "Дата":"Сегодня" } } How do I print text from each array like this? echo $news['Категория'];
Like this:
$news = json_decode($news); echo $news["Новости"]["Новость"]["Категория"]; json_decode be an associative array, you need to pass the second argument to the function: json_decode($news, true) - Dmitriy SimushevНовости is an object and not an array. - Dmitriy SimushevSource: https://ru.stackoverflow.com/questions/442495/
All Articles