$ menu包含:
In [15]: np.genfromtxt('trailing_comma.csv', delimiter=',', dtype=None, usecols=[0,1])
Out[15]:
array([[1, 2],
[3, 4]])
In [16]: col1, col2 = np.genfromtxt('trailing_comma.csv', delimiter=',', dtype=None, usecols=[0,1], unpack=True)
In [17]: col1
Out[17]: array([1, 3])
In [18]: col2
Out[18]: array([2, 4])
我想删除
Array
(
[0] => Array
(
[menu] => Array
(
[name] => Home
[controller] => frontends
[action] => index
)
)
[1] => Array
(
[menu] => Array
(
[name] => Feedback
[controller] => feedbacks
[action] => add
)
)
[2] => Array
(
[menu] => Array
(
[name] => Reseller
[controller] => resellers
[action] => login
)
)
)
工作正常。但我不确定这个菜单总是在2索引之下。所以我想在[2] => Array
(
[menu] => Array
(
[name] => Reseller
[controller] => resellers
[action] => login
)
)
unset($menu[2])
时删除此项目。有人能帮忙吗?
答案 0 :(得分:1)
没有测试过,但这应该可行。
foreach ($menu as $index => $menu_item) {
if ($menu_item['menu']['name'] == 'Reseller') {
unset($menu[$index]);
}
}