PHP Fatal error: Uncaught Error: Class 'GatewayWorker\BusinessWorker' not found

PHP Fatal error:  Uncaught Error: Class 'GatewayWorker\BusinessWorker' not found in /var/www/html/Applications/temp/start_businessworker.php:16
Stack trace:
#0 /var/www/html/start.php(34): require_once()
#1 {main}
  thrown in /var/www/html/Applications/temp/start_businessworker.php on line 16
已邀请:

blogdaren - 乐于分享的PHP码农【http://www.blogdaren.com】

赞同来自:

启动文件没有正确的 use \GatewayWorker\BusinessWorker;  吗?

bluelight2003 - 80后

赞同来自:

use \Workerman\Worker;
use \GatewayWorker\BusinessWorker;
use \Workerman\Autoloader;
require_once __DIR__.'/../../vendor/Workerman/Autoloader.php';

// bussinessWorker 进程
$worker = new BusinessWorker();

blogdaren - 乐于分享的PHP码农【http://www.blogdaren.com】

赞同来自:

不是  
require_once __DIR__.'/../../vendor/Workerman/Autoloader.php';
而是
require_once ‘/path/to/vendor/autoload.php';

bluelight2003 - 80后

赞同来自:

非常感谢您的指导   随后对路径详细了解了一下    最后把文件的整体目录结构调整了一下  
Workerman[start.php] start in DEBUG mode
------------------------------- WORKERMAN --------------------------------
Workerman version:3.5.19          PHP version:7.0.33-0ubuntu0.16.04.1
-------------------------------- WORKERS ---------------------------------
proto   user            worker          listen          processes    status
Press Ctrl+C to stop. Start success.
 

cloudty

赞同来自:

我来插一句.  也有可能是因为  需要 通过 composer require workerman/gateway-worker  安装组件
我是直接复制的demo文件.结果就是出现这个..Class 'GatewayWorker\BusinessWorker' not found
折腾了好久..最后在README.md文件里面看到用 composer安装..  接着 就成功了....
官方文档就不能给个安装示例么.....
 

要回复问题请先登录注册