MY CODE:
$data['components'][] = array(
'id_component' => $component['id_component'],
'id_layout' => $component['id_layout'],
'component_type' => $this->model_webservice_webservice->getComponentTypeByID($component['id_component_type']),
'component_heading' => @$component['component_heading'],
'data' => $component_data,
'product_data' => $products
);
错误行:"component_heading"=比;@ $组件[' component_heading '],
误差:未定义数组键"component_heading"in C:xampphtdocs***extensionmodulewebservice.php on line 1870Warning:
避免使用错误抑制操作符(它的行为自PHP8以来已更改)
当没有这样的键时,可以使用以下语法之一:
'component_heading' => $component['component_heading'] ?? null, // null coalesce operator
'component_heading' => isset($component['component_heading']) ? $component['component_heading'] : null,
'component_heading' => array_key_exists('component_heading', $component) ? $component['component_heading'] : null,