开发者

Module based php system

I'm trying to make a module based php system.

Each module is a class which implements a module interface and got the same name as the php file. Each module is located inside a directory called Modules.

I can list every module in the directory, but how do i ge开发者_StackOverflowt an instance of them? Is it even possible?

A little pseudo-code to make it easier to understand:

    foreach(scandir($module_dir) as $file){
        include $file
        $module = new $file // How can i make this work??
 }


$module = new $$module_name();

http://php.net/manual/en/language.variables.variable.php

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜