我在 zend 框架应用程序的表单中有以下代码。
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' => "",
'captcha' => 'image',
'captchaOptions' => array(
'captcha' => 'image',
'font'=> APPLICATION_PATH . '/../public_html/assets/fonts/akbar.ttf',
'imgDir'=> APPLICATION_PATH . '/../public_html/assets/captcha/',
'imgUrl'=> '/assets/captcha/',
'wordLen' => 1,
'fsize'=>20,
'height'=>60,
'width'=>200,
'gcFreq'=>50,
'expiration' => 300)
));
并且表单元素的显示符合预期。
当我尝试使用以下代码验证表单时,即使我正确输入了验证码,它也总是返回错误。
if($this->getRequest()->isPost()) {
if($this->view->form->isValid($_POST)) {
任何关于如何正确验证它的解决方案都会有很大帮助。
谢谢尼扎姆