开发者

Initialize class objects problem

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜