Zend Form ReCaptcha无效

时间:2010-12-25 11:29:43

标签: php zend-framework forms recaptcha


我有一个简单的基于Zend的表单,带有reCaptcha元素:         $ form = new Zend_Form();         $形式 - >的setName( 'forgotpassword')              - >使用setMethod( 'POST');

    $public = Lyf_Config::get('recapctha.public');
    $private = Lyf_Config::get('recapctha.private');
    $recaptcha = new Zend_Service_ReCaptcha($public, $private);

    $captcha = new Zend_Form_Element_Captcha('recaptcha',array(
        'captcha' => 'ReCaptcha',
        'captchaOptions' => array(
            'captcha' => 'ReCaptcha',
            'service' => $recaptcha
    )));


    $form->addElements(array($captcha));

    $form->setDecorators(array(array('ViewScript', array('viewScript' => 'login/passwordform.phtml', 'escape' => false))));

我希望看到这样的元素:http://webmasterblog.com.ua/wp-content/uploads/2009/07/recaptcha-example.gif。但是,我看到了简单的输入文本元素,而不是这个元素。我做错了什么?
提前谢谢你。抱歉我的英文。

1 个答案:

答案 0 :(得分:0)

这很有帮助:

echo $captcha->getHtml();