PHP 正在尝试获取 属性 'full_name' 的非对象
PHP Trying to get property 'full_name' of non-object
foreach ($data as $dt_row) {
if ($coordinator != $dt_row->coordinator->full_name) {
$sheet->setCellValue('A' . $row, "Zmiana " . $dt_row->shift_code . " - " . $dt_row->coordinator->full_name);
$sheet->setCellValue('B' . $row, $dt_row->coordinator->position);
$sheet->getStyle('A' . $row . ':B' . $row)->getFont()->setBold(true);
$coordinator = $dt_row->coordinator->full_name;
$row++;
}
$sheet->setCellValue("A" . $row, $dt_row->user->full_name);
$sheet->setCellValue("B" . $row, $dt_row->user->position);
$row++;
}
returns “正在尝试获取 属性 'full_name' 的非对象”
数据结构如下所示
{
"shift_code": "B",
"coordinator": {
"full_name": "name surname",
"position": "Koordynator dzia\u0142u Kompletowania\/Monta\u017cu", ///language code here
"shift_code": "B"
},
"user": {
"full_name": "surname_emp name_emp",
"position": "Starszy pracownik dzia\u0142u Kompletowania\/Monta\u017cu"
}
}
我想我尝试获取 属性 是正确的,但是 mb 我看不到某些东西
已修复必须添加 ->data foreach ($data->data as $dt_row) 感谢您的帮助
foreach ($data as $dt_row) {
if ($coordinator != $dt_row->coordinator->full_name) {
$sheet->setCellValue('A' . $row, "Zmiana " . $dt_row->shift_code . " - " . $dt_row->coordinator->full_name);
$sheet->setCellValue('B' . $row, $dt_row->coordinator->position);
$sheet->getStyle('A' . $row . ':B' . $row)->getFont()->setBold(true);
$coordinator = $dt_row->coordinator->full_name;
$row++;
}
$sheet->setCellValue("A" . $row, $dt_row->user->full_name);
$sheet->setCellValue("B" . $row, $dt_row->user->position);
$row++;
}
returns “正在尝试获取 属性 'full_name' 的非对象” 数据结构如下所示
{
"shift_code": "B",
"coordinator": {
"full_name": "name surname",
"position": "Koordynator dzia\u0142u Kompletowania\/Monta\u017cu", ///language code here
"shift_code": "B"
},
"user": {
"full_name": "surname_emp name_emp",
"position": "Starszy pracownik dzia\u0142u Kompletowania\/Monta\u017cu"
}
}
我想我尝试获取 属性 是正确的,但是 mb 我看不到某些东西
已修复必须添加 ->data foreach ($data->data as $dt_row) 感谢您的帮助