thinkphp5.1运行workerman出现Cannot use Workerman\Worker as Worker because the name is already in use错误

这是因为命名空间冲突导致的错误。
修改方法:

1.找到文件:
\vendor\topthink\think-worker\src\command\Server.php
 
找到命名空间:
use Workerman\Worker;
修改为:
use Workerman\Worker as Worker2;
紧接着把7597108119126行的 Worker 改为 Worker2
 
 
2.找到文件:
\vendor\topthink\think-worker\src\command\GatewayWorker.php
 
找到命名空间
use Workerman\Worker;
修改为:
use Workerman\Worker as Worker3;
紧接着把108176行的Worker改为Worker3

下面是我已经修改好的,可以直接用我修改好的这两个文件替换掉原来的
\vendor\topthink\think-worker\src\command\Server.php
\vendor\topthink\think-worker\src\command\GatewayWorker.php

文件下载链接:https://pan.baidu.com/s/10gM8YW_VqvZoOIx9v6NOrA 密码:e28f

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: