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
启动文件没有正确的 use \GatewayWorker\BusinessWorker; 吗?
use \Workerman\Worker;
use \GatewayWorker\BusinessWorker;
use \Workerman\Autoloader;
require_once __DIR__.'/../../vendor/Workerman/Autoloader.php';
// bussinessWorker 进程
$worker = new BusinessWorker();
start_businessworker.php
有没有引入自动加载文件? autoload那个
use \Workerman\Worker;
use \GatewayWorker\BusinessWorker;
use \Workerman\Autoloader;
require_once __DIR__.'/../../vendor/Workerman/Autoloader.php';
// bussinessWorker 进程
$worker = new BusinessWorker();
不是 require_once __DIR__.'/../../vendor/Workerman/Autoloader.php';
而是
require_once ‘/path/to/vendor/autoload.php';
非常感谢您的指导 随后对路径详细了解了一下 最后把文件的整体目录结构调整了一下
Workerman 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.
我来插一句. 也有可能是因为 需要 通过 composer require workerman/gateway-worker 安装组件
我是直接复制的demo文件.结果就是出现这个..Class 'GatewayWorker\BusinessWorker' not found
折腾了好久..最后在README.md文件里面看到用 composer安装.. 接着 就成功了....
官方文档就不能给个安装示例么.....
每个项目的readme就是文档啊,自己不看怪别人?