我一直在寻找如何做到这一点,有点难过。我的数组如下:
$returndata->setup_array = array(
'General' => array(
'Main Details' => 'setup/maindets',
'Directories' => 'directories',
'Extension Allocation' => 'xtnallo',
'List Holidays' => 'setup/holidays',
'List Group VM' => 'groupvm',
'Conference Rooms' => 'confroom'
),
'Offices' => array(
'List Offices' => 'iptoffices'
),
'Users' => array(
'List Users' => 'iptusers'
),
'Phones' => array(
'List Phones' => 'iptphones'
),
);
但是,我有 1 项在特定条件下(由用户会话触发)需要添加到通用数组的列表中。该部分是'View Details => setup/viewdetails'
. 我已经尝试过数组推送(可能不正确),但这会将项目作为另一个数组添加到主数组的末尾。
我希望/需要它像这样工作:
$returndata->setup_array = array(
'General' => array(
$viewdets
'Main Details' => 'setup/maindets',
'Directories' => 'directories',
'Extension Allocation' => 'xtnallo',
'List Holidays' => 'setup/holidays',
'List Group VM' => 'groupvm',
'Conference Rooms' => 'confroom'
),
'Offices' => array(
'List Offices' => 'iptoffices'
),
'Users' => array(
'List Users' => 'iptusers'
),
'Phones' => array(
'List Phones' => 'iptphones'
),
);
$viewdets = "'View Details' => 'setup/viewdetails'";
并且仍然被解释为用作菜单的功能数组。