gpt4 book ai didi

php - Symfony 4 AuthenticationUtils

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:46:22 24 4
gpt4 key购买 nike

我正在尝试根据 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,
)
));
}

错误:

Controller “App\Controller\SecurityController::loginAction()”要求您为“$authUtils”参数提供一个值。参数可以为空且未提供空值、未提供默认值或因为此参数后有非可选参数。

我不知道如何解决这个问题。有人有什么建议吗?

最佳答案

我遇到了同样的问题..尝试运行命令:

composer require security

关于php - Symfony 4 AuthenticationUtils,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47611706/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com