美文网首页
踩坑easySwoole自定义配置文件

踩坑easySwoole自定义配置文件

作者: 腿长袖子短 | 来源:发表于2019-12-16 21:37 被阅读0次

版本:easyswoole 2.1.4
问题:根据官方手册自定义配置文件,启动easySwoole报错

PHP Fatal error:  Uncaught Error: Using $this when not in object context in /www/wwwroot/easySwoole/EasySwooleEvent.php:29
Stack trace:
#0 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/src/Core/Core.php(38): EasySwoole\EasySwooleEvent::frameInitialize()
#1 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(268): EasySwoole\Core\Core->initialize()
#2 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(25): serverStart(Array)
#3 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(462): commandHandler()
#4 /www/wwwroot/easySwoole/easyswoole(2): require('/www/wwwroot/ea...')
#5 {main}
  thrown in /www/wwwroot/easySwoole/EasySwooleEvent.php on line 29

Fatal error: Uncaught Error: Using $this when not in object context in /www/wwwroot/easySwoole/EasySwooleEvent.php:29
Stack trace:
#0 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/src/Core/Core.php(38): EasySwoole\EasySwooleEvent::frameInitialize()
#1 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(268): EasySwoole\Core\Core->initialize()
#2 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(25): serverStart(Array)
#3 /www/wwwroot/easySwoole/vendor/easyswoole/easyswoole/bin/easyswoole(462): commandHandler()
#4 /www/wwwroot/easySwoole/easyswoole(2): require('/www/wwwroot/ea...')
#5 {main}
  thrown in /www/wwwroot/easySwoole/EasySwooleEvent.php on line 29
wjd@ubuntu:/www/wwwroot/easySwoole$ netstat -tunlp | grep 9501
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)

分析
这个图是官网文档截图
1.绿箭头指的方法,应该定义为一个静态方法,不能像图中这样定义
正确定义:public static function loadConf($ConfPath)
2.红箭头指向的调用形式错误,在静态方法中使用$this调用,(你他妈在逗我?)
正确调用方法:self::loadConf(EASYSWOOLE_ROOT . '/Config');

坑的截图

官网文档就这么敷衍吗

相关文章

网友评论

      本文标题:踩坑easySwoole自定义配置文件

      本文链接:https://www.haomeiwen.com/subject/ofcjnctx.html