gpt4 book ai didi

zend-framework - Zend Framework 1.10中Captcha元素的自定义错误消息

转载 作者:行者123 更新时间:2023-12-03 22:42:38 25 4
gpt4 key购买 nike

我正在尝试将自己的自定义错误消息设置到我的验证码上,但是由于某种原因,它回响了两次。

这是我的验证码:

$captcha = new Zend_Form_Element_Captcha(
'captcha', // This is the name of the input field
array('captcha' => array(
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 6,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => 'images/captcha/font/arial.ttf',
// URL to the images
'imgUrl' => '/images/captcha',
//alt tag to keep SEO guys happy
'imgAlt' => "Captcha Image - Please verify you're human"
)));

然后设置我自己的错误信息:
$captcha->setErrorMessages(array('badCaptcha' => 'My message here'));

当验证失败时,我得到:
'My message here; My message here'

为什么会复制错误,我该如何解决?

最佳答案

在花了很多时间尝试使之工作之后,我最终在构造函数的选项中设置了消息

$captcha = new Zend_Form_Element_Captcha(
'captcha', // This is the name of the input field
array(
'captcha' => array(
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 6,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => 'images/captcha/font/arial.ttf',
// URL to the images
'imgUrl' => '/images/captcha',
//alt tag to keep SEO guys happy
'imgAlt' => "Captcha Image - Please verify you're human",
//error message
'messages' => array(
'badCaptcha' => 'You have entered an invalid value for the captcha'
)
)
)
);

关于zend-framework - Zend Framework 1.10中Captcha元素的自定义错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5076173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com