必须配置路径 "ewz_recaptcha" 处的 Symfony 4 Recaptcha 包 "public_key"

Symfony 4 Recaptcha bundle "public_key" at path "ewz_recaptcha" must be configured

我正在使用来自 https://packagist.org/packages/excelwebzone/recaptcha-bundle#v1.5.11 的 symfony 4 和 recaptcha 包,但我不知道为什么它不起作用。以下是我得到的错误。我配置了 env google recaptcha 变量。

The file "C:\xampp\htdocs\projects\symfony-template\config/packages/ewz_recaptcha.yaml" does not contain valid YAML in C:\xampp\htdocs\projects\symfony-template\config/packages/ewz_recaptcha.yaml (which is loaded in resource "C:\xampp\htdocs\projects\symfony-template\config/packages/ewz_recaptcha.yaml").

yaml 文件:

    ewz_recaptcha:
      public_key:  HIDDEN
      private_key:  HIDDEN
      # Not needed as "%kernel.default_locale%" is the default value for the locale key
      locale_key:  %kernel.default_locale%

HIDDEN 等于来自 google 的密钥,但出于安全原因我在此处进行了说明。

备注:

首先:您必须创建 config/packages/ewz_recaptcha.yaml

第二:YAML 文件必须是有效格式:

 ewz_recaptcha:
    public_key:  "here is your public key (this is just example)" 
    private_key: "here is your private key (this is just example too)
    # Not needed as "%kernel.default_locale%" is the default value for the locale key
    locale_key:  %kernel.default_locale%