【发布时间】:2020-03-31 07:46:44
【问题描述】:
lumen 内部的许多进程都使用“闭包”类。我知道闭包是什么,但我仍然想知道它在 Lumen 中的样子。因此,我需要找到定义类的文件。
比如我的authenticate.php中间件使用了“Closure”,你可以在代码顶部看到:
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Factory as Auth;
class Authenticate
{
/**
* The authentication guard factory instance.
*
* @var \Illuminate\Contracts\Auth\Factory
*/
protected $auth;
/**
* Create a new middleware instance.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
* @return void
*/
public function __construct(Auth $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if ($this->auth->guard($guard)->guest()) {
return response('Unauthorized.', 401);
}
return $next($request);
}
}
但与 Lumen 中的任何其他类不同,该类不提供任何指向源代码中类的位置的路径。我查了根目录,没有。
那么它在哪里?
【问题讨论】: