hello coders。我有一个像这样的数组
Array
(
[0] => Array
(
[0] => admin/login
[1] => LoginHandler
[2] => index
)
[1] => Array
(
[0] => post
[1] => PostHandler
[2] => index
)
[2] => Array
(
[0] => post/create
[1] => postHandler
[2] => create
)
[3] => Array
(
[0] => post/update
[1] => postHandler
[2] => update
)
[4] => Array
(
[0] => post/delete
[1] => postHandler
[2] => delete
)
)
我只想要像admin/login, LoginHandler,index,
这样的值
post,PostHandler,index
,
post/create,PostHandler,create
等等。那怎么做?
答案 0 :(得分:2)
您可以遍历数组以对每个元素执行操作:
foreach ( $your_array as $element ) {
if ( is_array( $element ) ) {
foreach ( $element as $sub_element ) {
// You can store this value in a variable, or output it in your desired format.
echo $sub_element . "<br />";
}
}
else {
echo $element . "<br />";
}
}