Пример #1
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new PHPRPC_Server();
     $actions = explode(',', C('APP_PHPRPC_ACTIONS'));
     foreach ($actions as $action) {
         //$server -> setClass($action.'Action');
         $temp = $action . 'Action';
         $methods = get_class_methods($temp);
         $server->add($methods, new $temp());
     }
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
Пример #2
0
 /**
  * PHPRpc控制器架构函数
  * @access public
  */
 public function __construct()
 {
     //导入类库
     think\loader::import('vendor.phprpc.phprpc_server');
     //实例化phprpc
     $server = new \PHPRPC_Server();
     $server->add($this);
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
 }
Пример #3
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function run()
 {
     // 设定错误和异常处理
     set_error_handler(array('App', "appError"));
     set_exception_handler(array('App', "appException"));
     //[RUNTIME]
     // 检查项目是否编译过
     // 在部署模式下会自动在第一次执行的时候编译项目
     if (defined('RUNTIME_MODEL')) {
         // 运行模式无需载入项目编译缓存
     } elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) {
         // 直接读取编译后的项目文件
         C(include RUNTIME_PATH . '~app.php');
     } else {
         // 预编译项目
         App::build();
     }
     //[/RUNTIME]
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new PHPRPC_Server();
     $actions = explode(',', C('APP_PHPRPC_ACTIONS'));
     foreach ($actions as $action) {
         //$server -> setClass($action.'Action');
         $temp = $action . 'Action';
         $methods = get_class_methods($temp);
         $server->add($methods, new $temp());
     }
     if (C('APP_DEBUG')) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     //C('PHPRPC_COMMENT',$server->comment());
     echo $server->comment();
     // 保存日志记录
     if (C('LOG_RECORD')) {
         Log::save();
     }
     return;
 }
Пример #4
0
 /**
  * 架构函数
  * @access public
  */
 public function __construct()
 {
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //实例化phprpc
     $server = new \PHPRPC_Server();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
         $methods = array_diff($methods, array('__construct', '__call', '_initialize'));
     }
     $server->add($methods, $this);
     if (APP_DEBUG || $this->debug) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     echo $server->comment();
 }
Пример #5
0
 /**
  * 架构函数
  * @access public
  */
 public function __construct()
 {
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //导入类库
     Vendor('phpRPC.phprpc_server');
     //实例化phprpc
     $server = new \PHPRPC_Server();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
     }
     $server->add($methods, $this);
     if (APP_DEBUG) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     echo $server->comment();
 }