我希望将所有控制器及其方法放在一个数组中。
例如,我的inventory
控制器中的以下代码:
public function get_all_methods()
{
echo '<pre>';
print_r(get_class_methods($this));
echo '</pre>';
}
给出这个输出:
Array
(
[0] => __construct
[1] => index
[2] => add_product
[3] => edit_product
[4] => delete_product
)
但我想要这样的事情:
Array
(
[Inventory] => Array
(
[0] => __construct
[1] => index
[2] => add_product
[3] => edit_product
[4] => delete_product
)
[Invoice] => Array
(
[0] => __construct
[1] => index
[2] => create_invoice
[3] => invoice_list
)
)
如何从输出数组中删除一些已知方法,如__construct
和index
?