stdClass Object
(
[return] => [
{
"date":"19.02.2021",
"time_start":"16:00:00",
"duration":900,
"time_end":"16:15:00",
"employee_id":"01234567890"
},
{
"date":"19.02.2021",
"time_start":"16:15:00",
"duration":900,
"time_end":"16:30:00",
"employee_id":"01234567890"
},
{
"date":"20.02.2021",
"time_start":"10:45:00",
"duration":900,
"time_end":"11:00:00",
"employee_id":"gbkdbfndsbvvfnsd"
}
]
)
[0]=>19.02.2021
[1]=>19.02.2021
[2]=>20.02.2021
https://www.php.net/manual/ru/function.json-decode.php- делаю так:
$result = $objSOAP->GetFreeTimetable($arFields);
$test = json_decode($result);
file_put_contents($_SERVER["DOCUMENT_ROOT"] . '/POST.txt', "<pre>" . '$key' . ' - ' . print_r($test, 1) . "</pre>", FILE_APPEND);
откуда берется stdClass у тебя в вопросе?- приходит из 1С, если верно понимаю.
$result = $objSOAP->GetFreeTimetable($arFields);
$json = json_decode($result->return);
$res = array_map(function($item) {
return $item->date;
}, $json);
file_put_contents($_SERVER["DOCUMENT_ROOT"] . '/POST.txt', "<pre>".'$key'.' - ' . print_r($res, 1) . "</pre>", FILE_APPEND);
<?php
$obj = new stdClass();
$obj->return = '[
{
"date":"19.02.2021",
"time_start":"16:00:00",
"duration":900,
"time_end":"16:15:00",
"employee_id":"01234567890"
},
{
"date":"19.02.2021",
"time_start":"16:15:00",
"duration":900,
"time_end":"16:30:00",
"employee_id":"01234567890"
},
{
"date":"20.02.2021",
"time_start":"10:45:00",
"duration":900,
"time_end":"11:00:00",
"employee_id":"gbkdbfndsbvvfnsd"
}
]';
$json = json_decode($obj->return);
$res = array_map(function($item) {
return $item->date;
}, $json);
var_dump($res);