我看了有关数组和未定义的文章,并尝试应用in_array合成器,但是我总是遇到同样的问题。也许我做错了!
PHP arrays and solution to 'undefined index' errors
if (is_array($item['points']))
创建错误
注意:未定义索引:点数
谢谢
foreach ($list_point as $carrier) {
if (is_array($carrier)) {
foreach ($carrier as $item) {
if (is_array($item['points'])) {
foreach ($item['points'] as $points) {
if (is_array($points)) {
$result_carrier_code[] = ['id' => $points['code'],
'text' => $points['city'] . ' / ' . $points['name'] . ' / ' . $points['address'] . ' / ' . $points['code']
];
}
}
}
}
}