我正在尝试内爆这个数组:
$name;
foreach ($childs as $cval) {
$name[] = $cval;
}
这就是我得到的:
Array
(
[0] => Array
(
[0] => Array
(
[pages_name] => services child 1
)
[1] => Array
(
[pages_name] => services child 2
)
)
[1] => Array
(
[0] => Array
(
[pages_name] => inner service child 1
)
[1] => Array
(
[pages_name] => inner service child 2
)
)
[2] => Array
(
[0] => Array
(
[pages_name] => gallery child 1
)
[1] => Array
(
[pages_name] => gallery child 2
)
)
)
我这样做array_map
是这样的:
$arr = array_map(function($el){ return $el['pages_name']; }, $name);
$str = implode(',', $arr);
我得到了这个错误:
Undefined index: pages_name