PHP
- 18 ответов
- 0 вопросов
13
Вклад в тег
:root {
font-size: 16px; // 1rem = 16px
}
div {
padding: .5rem; // 8px
}
$json = '{
"result": {
"Random ItemName": [
{
"user": "user1",
"time_upd": "2020-12-09 12:25:03"
}, {
"user": "user2",
"time_upd": "2020-12-09 12:25:03"
}, {
"user": "user3",
"time_upd": "2020-12-09 12:25:03"
}
]
}
}';
$data = json_decode($json, true);
$i = 0; // меняется в цикле
$user_name = $data['result']['Random ItemName'][$i]['user'];
$time_upd = $data['result']['Random ItemName'][$i]['time_upd'];
$user_name = $data['result'][array_key_first($data['result'])][$i]['user'];
$time_upd = $data['result'][array_key_first($data['result'])][$i]['time_upd'];
foreach ($data['result'] as $arrayKey => $arrayValue) {
foreach ($arrayValue as $arraySubvalue) {
$user_name = $arraySubvalue['user'];
$time_upd = $arraySubvalue['time_upd'];
// …
}
}
if ($fh = fopen('/public/vag102020.csv', 'r')) {
while (($csvStr = fgetcsv($fh, 1024, ';')) !== false) {
$csvArr[] = $csvStr;
}
}
$weight = $line[5] ?? 0;