开发者

Zend framework modules and Reflection

i'm a bit confused about modules, namespace and reflection.

$obj = new default_Model_foo();
$obj->bar();

The code above runs prope开发者_如何学Crly, but i need to add reflection;

I've got these variables:

$moduleName = "default";
$modelName  = "foo";
$function   = "bar";

I would like to instantiate a class at runtime, how can do it?

Thank you! Mirco.


$modelClass = "{$moduleName}_Model_{$modelName}";
$obj = new $modelClass();
$obj->$function();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜