开发者

Initialize class objects problem

开发者 https://www.devze.com 2023-02-10 00:17 出处:网络
I initialize class objects something like this and it works. $obj = new Model_Person_DbTable(); But开发者_如何学Go when do it like this:

I initialize class objects something like this and it works.

$obj = new Model_Person_DbTable();

But开发者_如何学Go when do it like this:

$className = 'Model_Person_DbTable()';
$obj = new $className;

Then it show following fatal error:

Model_Person_DbTable() class not found.

How can I achieve this in PHP/Zend


Try without the brackets (they are not part of the class name)

$className = 'Model_Person_DbTable';

If that doesnt help, make sure your autoloader and include path is set up correctly.

0

精彩评论

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