File tree Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change 14
14
class SwordEvent
15
15
{
16
16
/**
17
- * EasySwoole框架的 bootstrap 事件
17
+ * 入口启动事件
18
18
* 发生在框架初始化之前
19
19
*/
20
20
public static function bootstrap ()
21
21
{
22
22
// 加载助手函数
23
23
require_once __DIR__ ."/helper.php " ;
24
24
25
+ // 底层框架初始化
26
+ require_once __DIR__ ."/initialize.php " ;
27
+
25
28
// 时区设置
26
29
date_default_timezone_set (config ('app.timezone ' ) ?: 'Asia/Shanghai ' );
27
30
@@ -40,4 +43,4 @@ public static function mainServerCreate()
40
43
41
44
}
42
45
43
- }
46
+ }
Original file line number Diff line number Diff line change 1
1
<?php declare (strict_types=1 );
2
2
/**
3
- * Sword 助手函数
4
- * 任何地方都可以通过助手函数名快速调用
3
+ * Sword框架初始化
5
4
* @link http://sword.kyour.cn
6
5
* @document http://sword.kyour.cn/doc
7
6
* @contact kyour@vip.qq.com
8
7
* @license http://github.com/php-sword/sword/blob/master/LICENSE
9
- */
10
-
8
+ */
11
9
use EasySwoole \RedisPool \RedisPool ;
12
10
13
11
define ('SWORD_NULL ' , "SWORD_NULL_VALUE " );
14
12
define ('SWORD_REDIS_EXISTS ' , "SWORD_REDIS_EXISTS_VALUE " );
15
13
14
+ /**
15
+ * Sword 助手函数
16
+ * 任何地方都可以通过助手函数名快速调用
17
+ */
16
18
if (!function_exists ('container ' )) {
17
19
/**
18
20
* 容器操作 全局变量
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+ /**
3
+ * Easyswoole框架初始化
4
+ * 版本 3.4
5
+ */
6
+ use EasySwoole \EasySwoole \Command \CommandRunner ;
7
+ use EasySwoole \Command \Caller ;
8
+
9
+ defined ('IN_PHAR ' ) or define ('IN_PHAR ' , boolval (\Phar::running (false )));
10
+ defined ('RUNNING_ROOT ' ) or define ('RUNNING_ROOT ' , ROOT_PATH );
11
+ defined ('EASYSWOOLE_ROOT ' ) or define ('EASYSWOOLE_ROOT ' , IN_PHAR ? \Phar::running () : ROOT_PATH );
12
+
13
+ if (file_exists (EASYSWOOLE_ROOT .'/bootstrap.php ' )){
14
+ require_once EASYSWOOLE_ROOT .'/bootstrap.php ' ;
15
+ }
16
+
17
+ $ caller = new Caller ();
18
+ $ caller ->setScript (current ($ argv ));
19
+ $ caller ->setCommand (next ($ argv ));
20
+ $ caller ->setParams ($ argv );
21
+ reset ($ argv );
22
+
23
+ $ ret = CommandRunner::getInstance ()->run ($ caller );
24
+ if ($ ret && !empty ($ ret ->getMsg ())){
25
+ echo $ ret ->getMsg ()."\n" ;
26
+ }
You can’t perform that action at this time.
0 commit comments