0
我試圖破滅這個數組多維數組:如何破滅
$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