-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.php
42 lines (37 loc) · 993 Bytes
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Created by PhpStorm.
* User: tanghui
* Date: 2016/10/27
* Time: 16:24
*/
define('DEBUG', 'on');
define('WEBPATH', __DIR__);
define('BASEPATH',__DIR__."/");
#define('PHP_INT_MAX', 9223372036854775807);
function log_message($level, $message)
{
echo "[{$level}]{$message}\n";
}
require_once __DIR__ . '/Felix/Felix.php';
require_once __DIR__ . '/Felix/Loader.php';
require_once __DIR__.'/libs/smarty/libs/Smarty.class.php';
$config = require( __DIR__ . '/config/config.php');
$config['router']=require(__DIR__.'/config/router.php');
$config['ws_router']=require(__DIR__.'/config/ws_router.php');
/**
* 注册顶层命名空间到自动载入器
*/
Felix\Loader::addNameSpace('Felix', __DIR__.'/Felix');
spl_autoload_register('\\Felix\\Loader::autoload');
$felix=new \Felix();
$felix->init($config);
if(isset($argv[1])){
if($argv[1] == "ws"){
$felix->runWebSocket();
}else{
$felix->runCommand($argv);
}
}else{
$felix->runHttpServer();
}