我正在使用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的密钥,但出于安全原因,我在这里进行了介绍。
答案 0 :(得分:0)
注意:
首先:您必须创建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%