phpartisanmake:jobSendEmail--queued生成后在App\JobsnamespaceApp\Jobs;useApp\User;useApp\Jobs\Job;useIlluminate\Contracts\Mail\Mailer;useIlluminate\Queue\SerializesModels;useIlluminate\Queue\InteractsWithQueue;useIlluminate\Contracts\Bus\SelfHandling;useIlluminate\Contracts\Queue\ShouldQueue;classSendEmailextendsJobimplementsSelfHandling,ShouldQueue{useInteractsWithQueue,SerializesModels;protected$user;/***Createanewjobinstance.**@returnvoid*/publicfunction__construct(User$user){$this->user=$user;}/***Executethejob.**@returnvoid*/publicfunctionhandle(Mailer$mailer,$email){$mailer->send('emails.reminder',['user'=>$this->user],function($m){$m->to($email,'zan')->subject('发送成功');});}}在控制器里这么用;$email="onm@163.com";$job=(newSendEmail($user,$email))->delay(260);$this->dispatch($job);在这里传email到handle方法里面;可handle方法里根本获取不到$email这个变量Jobs队列处理如何传入更多数据呢在控制器里传入求大神指导一下呀
慕桂英546537
扬帆大鱼
相关分类