继承worker

Hxuhao233
class tcp_server extends Worker{
    public function _construct(){
        $this->Worker("tcp://0.0.0.0:6666");
        $this->count = 4;
    }

}

这样写抛出异常

PHP Notice:  Undefined offset: 1 in /home/hxuhao/GoAPPServer/Workerman/Worker.php on line 1361

Notice: Undefined offset: 1 in /home/hxuhao/GoAPPServer/Workerman/Worker.php on line 1361
PHP Fatal error:  Uncaught exception 'Exception' with message 'class \Protocols\6666 not exist' in /home/hxuhao/GoAPPServer/Workerman/Worker.php:1373
Stack trace:
#0 /home/hxuhao/GoAPPServer/Workerman/Worker.php(479): Workerman\Worker->listen()
#1 /home/hxuhao/GoAPPServer/Workerman/Worker.php(365): Workerman\Worker::initWorkers()
#2 /home/hxuhao/GoAPPServer/tcp_server.class.php(75): Workerman\Worker::runAll()
#3 {main}
  thrown in /home/hxuhao/GoAPPServer/Workerman/Worker.php on line 1373
2622 1 0
1个回答

walkor 打赏

对workerman源码不熟悉,不建议用继承的方式使用Worker。
请按照手册使用。

  • 暂无评论
年代过于久远,无法发表回答
×
🔝