我正在尝试根据 symfony.com 的教程使用 symfony 4 创建用户登录。
我使用了带有以下代码的基本 services.yaml 文件。
https://symfony.com/doc/current/security/form_login_setup.html
public function loginAction(Request $request, \Twig_Environment $twigRenderer,AuthenticationUtils $authUtils)
{
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return new response($twigRenderer->render('security/login.html.twig', array(
'last_username' => $lastUsername,
'error' => $error,
)
));
}
错误:
控制器“App\Controller\SecurityController::loginAction()”要求您为“$authUtils”参数提供一个值。参数可以为空并且没有提供空值,没有提供默认值,或者因为在此参数之后有一个非可选参数。
我不知道如何解决这个问题。有人有建议吗?