Example #1
0
 /**
  * 构造函数
  *
  * 构造应用程序对象,并且初始化根上下文对象
  *
  * @param array $app_config
  */
 protected function __construct(array $app_config)
 {
     $this->_appid = $app_config['APPID'];
     self::$_apps[$this->_appid] = $this;
     self::setAppConfig($this->_appid, $app_config);
     $this->_default_module = QApplication_Module::instance(null, $this->_appid);
     $this->context = QContext::instance(null, $this->_appid);
     // #IFDEF DEBUG
     QLog::log(__METHOD__, QLog::DEBUG);
     // #ENDIF
     // 设置默认的异常处理例程
     // set_exception_handler(array($this, 'exceptionHandler'));
 }
Example #2
0
 /**
  * 返回该模块的模块名
  *
  * @return string
  */
 function moduleName()
 {
     return $this->_module->moduleName();
 }
Example #3
0
 /**
  * 返回指定模块的上下文对象
  *
  * @param string $module_name
  * @param string $appid
  *
  * @return QContext
  */
 static function instance($module_name = null, $appid = null)
 {
     if (empty($appid)) {
         $appid = QApplication_Abstract::defaultAppID();
     }
     if (empty($module_name)) {
         $module_name = QApplication_Module::DEFAULT_MODULE_NAME;
     }
     if (!isset(self::$_instances[$appid][$module_name])) {
         new QContext(QApplication_Module::instance($module_name, $appid));
     }
     return self::$_instances[$appid][$module_name];
 }