开发者

Zend framework modules and Reflection

开发者 https://www.devze.com 2023-01-18 18:51 出处:网络
i\'m a bit confused about modules, namespace and reflection. $obj = new default_Model_foo(); $obj->bar();

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

精彩评论

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

关注公众号