LeavePercentageFactory::class, 'SpecialCompoentFactory' => SpecialCompoentFactory::class, 'SpecialCompoentCaculateFactory' => SpecialCompoentCaculateFactory::class, 'MarketPercentageFactory' => MarketPercentageFactory::class, ]; public function __construct() { } //获取实例化接口 static function getInstance() { if (!(self::$instance instanceof self)) { self::$instance = new self(); } return self::$instance; } //工厂类返回实例化类 public function factoryClass($name = '') { if (!$name) { return false; } $className = "{$name}{$this->suffix}"; if ($this->classes[$className]) { return (new $this->classes[$className]); } else { return false; } } }