示例#1
0
文件: app.php 项目: hitzheng/ares
 /**
  * web app请求派发
  * @return [type] [description]
  */
 public function dispatch()
 {
     if ('cli' == PHP_SAPI) {
         exit("[ERROR] can't call dispatch under CLI environment!");
     }
     try {
         $this->_initPlugin();
         $this->_callPlugin('onStart');
         $this->_doStart();
         $this->_callPlugin('onRoute');
         $this->_doRoute();
         $this->_callPlugin('onRun');
         $this->_doRun();
         $this->_callPlugin('onStop');
         $this->_doStop();
     } catch (Exception $e) {
         // 交由统一异常程序处理
         Core_Exception::getInstance()->handleException($e);
     }
 }
示例#2
0
<?php

/**
 * 框架入口文件
 * @author  hitzheng
 */
// 常量定义
define('SYSTEM_VERSION', '1.0.0');
define('SYSTEM_START_TIME', microtime(true));
define('CODE_SUCCESS', 1000);
define('CODE_FAILED', 1001);
define('CODE_PARAM_ERROR', 1002);
define('CODE_NEED_LOGIN', 1003);
// 自动加载
require SYS_PATH . '/library/core/loader.php';
spl_autoload_register(array(Core_Loader::getInstance(), 'loadClass'));
// 异常处理
Core_Exception::getInstance()->init();