使用demo代码运行
<?php
use Workerman\Worker;
require_once __DIR__ . '/Workerman/Autoloader.php';
// 创建一个Worker监听2345端口,使用http协议通讯
$http_worker = new Worker("http://0.0.0.0:2345");
// 启动4个进程对外提供服务
$http_worker->count = 4;
// 接收到浏览器发送的数据时回复hello world给浏览器
$http_worker->onMessage = function($connection, $data)
{
// 向浏览器发送hello world
$connection->send('hello world');
};
// 运行worker
Worker::runAll();
一启动就会抛错
Fatal error: Uncaught Error: Class '' not found in /private/tmp/Workerman/Worker.php:2395
Stack trace:
#0 /private/tmp/Workerman/Worker.php(1554): Workerman\Worker->run()
#1 /private/tmp/Workerman/Worker.php(1384): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#2 /private/tmp/Workerman/Worker.php(1358): Workerman\Worker::forkWorkersForLinux()
#3 /private/tmp/Workerman/Worker.php(1691): Workerman\Worker::forkWorkers()
#4 /private/tmp/Workerman/Worker.php(1640): Workerman\Worker::monitorWorkersForLinux()
#5 /private/tmp/Workerman/Worker.php(544): Workerman\Worker::monitorWorkers()
#6 /private/tmp/Workerman/start.php(19): Workerman\Worker::runAll()
#7 {main}
thrown in /private/tmp/Workerman/Worker.php on line 2395
重新更新下workerman试下
请问 解决了吗 我也碰到一模一样的问题了