think-queue3.04 command\Work报错

浏览:667 发布日期:2019/05/12 分类:ThinkPHP6专区 关键字: think-queue
/**
* 注册事件
*/
protected function listenForEvents()
{
$this->app->event->listen(JobProcessing::class, function ($event) {
$this->writeOutput($event->job, 'starting');
});

$this->app->event->listen(JobProcessed::class, function ($event) {
$this->writeOutput($event->job, 'success');
});

$this->app->event->listen(JobFailed::class, function ($event) {
$this->writeOutput($event->job, 'failed');

$this->logFailedJob($event);
});
}
回调的event是个闭包,导致$event->job提示空引用,不知道解决了没用?还是我用法不正确?
最佳答案
评论( 相关
后面还有条评论,点击查看>>