public function __construct($request = null) { if (isset($_SERVER['HTTP_HHVM_PATHINFO'])) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_HHVM_PATHINFO']; } if (self::$_instance !== null) { throw new LogicException('Dola Application cannot be initialized again'); } self::$_instance = $this; $this->printRequestURI(); //获得module,controller,action $this->initRequest($request); if (!ctype_alnum($this->_module) || !in_array($this->_module, Env::getAllModule()) || 'index' == $this->_controller) { Env::getLogger()->Info('Illegal Module or Controller---Module:' . $this->_module . " Controller:" . $this->_controller); exit(22); } $module_class_name = $this->_module . '_Module'; if (class_exists($module_class_name)) { $this->_moduleInstance = new $module_class_name(); } else { Env::getLogger()->Info('Fatal Load Module ' . $this->_module . ' Cannot Find Class'); exit(22); } ini_set("error_log", str_replace("#module#", strtolower($this->_module), EnvConf::$phpLogPath)); Env::setLogName(ucfirst($this->_module)); Env::getLogger()->refreshIP(Env::getIP()); return self::$_instance; }