问题1、job 队列任务代码修改后不生效
对 laravel job 队列的代码进行了修改,但是没有生效,查看了一下官方手册,原来要执行一下:文章来源:https://www.toymoban.com/news/detail-702079.html
php artisan queue:restart
问题2、执行job里的任务命令
php artisan queue:work redis --queue=gdt
//gdt是队列的名称 redis队列存放的位置
问题3、使用laravel下载excel出现报错,只需要修改跨域中间件就好了
Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header()文章来源地址https://www.toymoban.com/news/detail-702079.html
public function handle($request, Closure $next)
{
if($request->isMethod('OPTIONS')) {
$response = response('', 200);
} else {
$response = $next($request);
}
$IlluminateResponse = 'Illuminate\Http\Response';
$SymfonyResopnse = 'Symfony\Component\HttpFoundation\Response';
$headers = [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, PATCH, DELETE',
'Access-Control-Allow-Headers' => 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Authorization , Access-Control-Request-Headers, X-CSRF-TOKEN'
];
if ($response instanceof $IlluminateResponse) {
$response->header('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, PATCH, DELETE');
$response->header('Access-Control-Allow-Headers', $request->header('Access-Control-Request-Headers'));
$response->header('Access-Control-Allow-Origin', '*');
return $response;
}
if ($response instanceof $SymfonyResopnse) {
foreach ($headers as $key => $value) {
$response->headers->set($key, $value);
}
return $response;
}
return $response;
}
到了这里,关于Laravel 开发遇到的相关问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!