您可以简单地使用以下语法来创建新类(如果要创建factory,这将很方便):$className = $whatever;$object = new $className;作为(异常粗糙的)示例工厂方法:public function &factory($className) { require_once($className . '.php'); if(class_exists($className)) return new $className; die('Cannot create new "' . $className . '" class - includes not found or class unavailable.');}