错误Argument 2 passed to Swoole\Server::on() must be callable, array given

swoole使用on()绑定事件报错Argument 2 passed to Swoole\Server::on() must be callable, array given

查阅文档

swoole支持四种方式绑定回调
四种设置回调函数的方式

我的解决办法

我这里是因为绑定的回调函数不是public权限,改成public就行了

public function pokerOpen($serv, $frame)
$this->serv->on('start', ([$this, 'pokerOpen']));