I was working with Laravel 5.3 and in one of the functions, I found this piece of code:

public function handle($request, Closure $next, ...$guards)
{
    $this->authenticate($guards);

    return $next($request);
}

代码来自\Illuminate\Auth\Middleware\Authenticate::class.

$guards变量前的3个点是什么?

推荐答案

它表明可能存在数量可变的参数.

When the function is called with more than 3 arguments, all the arguments after $next will be added to the $guards array.

You can read about it here.

Laravel相关问答推荐

当使用Craftable PRO时,Wysiwig是什么时候生成的?

Laravel中如何动态更改路由链接?

如何使用动态翻译键翻译 Laravel硬编码字符串(还有 1 个错误)..(验证异常类)

Laravel 9:AWS S3 检索要流式传输的视频

使用枢轴插入多对多时的Laravel问题

如何访问 Validator::extend 中的其他输入属性?

Lumen 中的自定义 404 页面

使用 Laravel 和 Passport 验证失败时响应状态码 401?

在 Laravel 5 中扩展请求类

laravel 5 中的登录事件处理

laravel 预期响应代码 250 但得到代码530

如何卸载 Laravel?

在 Laravel 的 Homestead 中运行 PHPUnit

我如何从给定的日期时间 struct 创建Carbon 对象?

Laravel 项目旁边的 Wordpress 项目(在 public_html 文件夹中)

防止 Eloquent 查询上的模型水合

将自定义消息(或任何其他数据)传递给 Laravel 404.blade.php

如何以及在哪里可以使用 laravel 存储图像?

Laravel 手动登录功能

你如何在 Laravel 5.3 的新通知服务生成的Electron邮件中添加图像?