2010-05-10 69 views

回答

1

尝试这样的自举类中:

$methods = get_class_methods ('MyBootstrap'); 
foreach ($methods AS $method) { 
    if (str_pos ($method, '_init') !== false) { 
     call_user_func (array ($this, $method)); 
    } 
} 

get_class_methods - 返回类的方法名。然后查找'_init'等方法并运行它们。

+0

是不是有更一致的东西? – 2010-05-17 14:06:44

+0

没有我会意识到的。只有其他方法是手动调用每种方法,但我想这不是你想要的。 – 2010-05-17 14:56:40