I installed bundle excelwebzone/recaptcha-bundle
by composer on Symfony 2.7.8, added to bundles:
new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle()
added reCAPTCHA to form builder in my custom controller and got error:
Could not load type
"EWZ\\Bundle\\RecaptchaBundle\\Form\\Type\\RecaptchaType"
invendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php
at line 83
What am I doing wrong?
I found a solution in this tutorial :
In Symfony 2.7 I have to write:
$builder->add('recaptcha', 'ewz_recaptcha');
Instead of:
$builder->add('recaptcha', 'EWZ\Bundle\RecaptchaBundle\Form\Type\RecaptchaType');
The initial solution probably works in Symfony >=2.8.
查看https://github.com/excelwebzone/EWZRecaptchaBundle/blob/master/Form/Type/EWZRecaptchaType.php ,类名是EWZRecaptchaType
(不仅RecaptchaType
没有前导EWZ
)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.