【发布时间】:2021-12-04 00:15:27
【问题描述】:
当我试图覆盖默认密码重置功能时,我遇到了一些奇怪的关闭问题。
$response = $this->broker()->reset(
// the 3rd variable $pwAge has to be passed via use()
$this->credentials($request), function ($user, $password) use($pwAge) {
$this->resetPassword($user, $password, $pwAge);
}
);
第三个变量 $pwAge 必须通过
传递给闭包use($pwAge)
如果与前两个参数一起传递:
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password, $pwAge) {
$this->resetPassword($user, $password, $pwAge);
}
);
调用这个函数会报如下错误:
Symfony\Component\Debug\Exception\FatalThrowableError
Too few arguments to function App\Http\Controllers\Auth\ResetPasswordController::App\Http\Controllers\Auth\{closure}(), 2 passed in vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php on line 96 and exactly 3 expected
我在这里缺少什么?请指教,谢谢。
【问题讨论】: