Answer the question
In order to leave comments, you need to log in
How to read JSON in PHP?
[
{
"token": "тут токен",
"id": "тут айди",
"hidden_friends": 2,
"timezone": "Europe/Kaliningrad"
},
{
"token": "тут токен",
"id": "тут айди",
"hidden_friends": 0,
"timezone": "Europe/Paris"
}
]
<?php
$users = file_get_contents('users.json');
$data = json_decode($users, true);
$id = $data['id'];
echo $id;
?>
Answer the question
In order to leave comments, you need to log in
and doesn't work
foreach ($data as $datum) {
$id = $datum['id'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question