Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Zend PHP的Recaptcha样式_Php_Zend Framework - Fatal编程技术网

使用Zend PHP的Recaptcha样式

使用Zend PHP的Recaptcha样式,php,zend-framework,Php,Zend Framework,我在一个项目中使用Zend_Service_ReCaptcha,希望定制盒子的配色方案,但我完全不知道使用哪种功能来实现这一点。 似乎没有任何线索 非常感谢您的回答。您需要通过将主题选项传递到表单元素: 比如: $element = new Zend_Form_Element_Captcha('foo', array( 'label' => "Please verify you're a human", 'captcha' => array( 'cap

我在一个项目中使用Zend_Service_ReCaptcha,希望定制盒子的配色方案,但我完全不知道使用哪种功能来实现这一点。 似乎没有任何线索


非常感谢您的回答。

您需要通过将主题选项传递到表单元素:

比如:

$element = new Zend_Form_Element_Captcha('foo', array(
    'label' => "Please verify you're a human",
    'captcha' => array(
        'captcha' => 'Recaptcha',
        'timeout' => 300,
        'theme'   => 'red'
    ),
));

通过表单元素参数设置此选项无效!这个选项(“theme”和“lang”)应该传递给服务

下面是Zend_服务_ReCaptcha构造函数:

public function __construct($publicKey = null, $privateKey = null,
                                $params = null, $options = null, $ip = null)
{
…
用法:

$options = array('theme' => 'white', 'lang' => 'ru');
$recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, null, $options);

$this->view->recaptcha = $recaptcha->getHtml();
否则,如果您想使用表单元素,您应该首先获取服务对象。试试这样:

$options = array('theme' => 'white', 'lang' => 'ru');
$form->getElement('captcha')->getCaptcha()->getService()->setOptions($options);

当您在注册时,您将获得公钥和私钥,并在您的表单中设置它们,如下$recaptcha_service=new Zend_service_recaptcha($public,$private)

嗨,David,这样的脚本不完整。您必须添加私钥和公钥参数。当做