/** * 创建并执行当前应用,单应用访问入口 */ public function run() { $this->_app = $this->createApplication($this->_config['web-apps'][$this->_appName], WindFactory::_getInstance()); set_error_handler(array($this, '_errorHandle'), error_reporting()); set_exception_handler(array($this, '_exceptionHandle')); if ($this->_config['isclosed']) { throw new Exception('Sorry, Site has been closed!'); } if ($this->_chain !== null) { $this->_chain->getHandler()->handle('onCreate'); } /* @var $router WindRouter */ $router = $this->_app->getFactory()->getInstance('router'); $router->route($this->_app->getRequest()); if ($this->_chain !== null) { $this->_chain->getHandler()->handle('onStart'); } $this->_app->run($router); if ($this->_chain !== null) { $this->_chain->getHandler()->handle('onResponse'); } $this->_app->getResponse()->sendResponse(); $this->_app->getFactory()->executeDestroyMethod(); restore_error_handler(); restore_exception_handler(); }