예제 #1
0
파일: server.php 프로젝트: cloklo/CxWoole
function __swoole($daemonize = true)
{
    $swoole = new CxSwoole();
    $swoole->bootstrap('Bootstrap', $swoole);
    $swoole->setOption('daemonize', $daemonize);
    $swoole->run();
}
예제 #2
0
 public function __construct(CxSwoole $swoole)
 {
     $swoole->notfound(array($this, 'onNotfound'));
     $swoole->error(array($this, 'onError'));
     //$swoole->setCallback('task', array($this, 'onTask'));
     //$swoole->setCallback('finish', array($this, 'onFinish'));
     //$swoole->setCallback('timer', array($this, 'onTimer'));
     //$swoole->setCallback('workerstart', array($this, 'onWorkerStart'));
 }
예제 #3
0
파일: CxSwoole.php 프로젝트: cloklo/CxWoole
 public function onWorkerStart($serv, $worker_id)
 {
     $config = array();
     $include = explode(':', PATH_AUTOINCLUDE);
     $include[] = PATH_DAOS;
     $include[] = PATH_COMMON;
     $include[] = PATH_CONTROLLER;
     foreach ($include as $val) {
         $auto = glob($val . '*.php');
         if ($auto) {
             foreach ($auto as $v) {
                 include_once $v;
             }
         }
     }
     self::$config = $config;
     //判断是否为worker进程
     if ($worker_id < $serv->setting['worker_num']) {
         CxSwoole::$server = $serv;
         CxSwoole::$workid = $worker_id;
     }
     $this->workerstart and call_user_func($this->workerstart, $serv, $worker_id);
 }
예제 #4
0
파일: index.php 프로젝트: cloklo/CxWoole
<?php

//开启Session
//session_start();
//关闭所有错误警告
//ini_set("display_errors", 0);
//加载配置文件
include "config.mvc.php";
$swoole = new CxSwoole();
$swoole->bootstrap('Bootstrap', $swoole);
$swoole->run();