Answer the question
In order to leave comments, you need to log in
Why can't I add Captcha to the form?
Good day.
While developing a site on zf2, I encountered such a problem: when adding captcha to the form, an error occurs:
Fatal error: Class 'Zend\Captcha\Factory' not found in C:\xampp\htdocs\td.ru\vendor\zendframework\zend-form\src\Element\Captcha.php on line 53
namespace Users\Form;
use Zend\Form\Element;
use Zend\Form\Form;
use Zend\Captcha\AdapterInterface;
class RegisterForm extends Form {
protected $captcha;
public function __construct($name = null) {
parent::__construct('Register');
$this->setAttribute('method', 'post');
$this->setAttribute('enctype', 'multipart/form-data');
$this->add([
'type' => 'Zend\Form\Element\Captcha',
'name' => 'captcha',
'options' => [
'label' => 'Please verify you are human.',
'captcha' => [
'class' => 'Image',
'options' => [
'font' => __DIR__ . '/../assets/fonts/arial.ttf',
'width' => 200,
'height' => 100,
'dotNoiseLevel' => 40,
'lineNoiseLevel' => 3,
'imgDir' => '/path/to/image/captcha/will/be/generated'
],
],
],
]);
..................................
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question