sol*_*arc 0 php zend-framework
我怎么能用call_func_array一个__construct方法创建一个新对象(有些不是可选参数).
这是代码:
$urls = array(
'view' => array(
'view/(\d+)',
array('controller' => 'test', 'action' => 'view'),
array(1 => 'id'),
),
);
foreach ($urls as $name => $args) {
$route = call_user_func_array(Zend_Controller_Router_Route_Regex, $args);
$router->addRoute($name, $route);
}
Run Code Online (Sandbox Code Playgroud)
$ref = new ReflectionClass('Zend_Whatever');
foreach ($urls as $name => $args) {
$route = $ref->newInstanceArgs($args);
$router->addRoute($name, $route);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1570 次 |
| 最近记录: |