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
精彩评论