zend表单验证码问题
我正在使用 zend 形式的 zend 验证码。它工作正常,但是当它创建时,它会生成以下代码:
<img width="80" height="30" alt="Allindia captcha" src="/allindiazend/public/images/captcha/4ae305b05406c9d8b06a19ea7ff2c9d9.png"/><br/>
<input type="hidden" name="captcha[id]" value="4ae305b05406c9d8b06a19ea7ff2c9d9" title="Security Check." id="captchas" />
<input type="text" name="captcha[input]" id="captchas" value="" title="Security Check." />
由于此
,文本框出现在 img 下方。我不想在生成的代码中使用这个“br”标签。
这是我的验证码代码:
$captcha= new Zend_Form_Element_Captcha('captcha', array(
'id'=>'captchas',
'title'=>'Security Check.',
'captcha' => array(
'captcha' => 'Image',
'required' => true,
'font'=>'arial.ttf',
'wordlen'=>'4',
'width'=>'80',
'height'=>'30',
'ImgAlign'=>'left',
'imgdir'=>'public/images/captcha',
'DotNoiseLevel'=>'0',
'LineNoiseLevel'=>'0',
'Expiration'=>'1000',
'fontsize'=>'16',
'gcFreq'=>'10',
'ImgAlt'=>'Allindia captcha',
'imgurl'=>'/allindiazend/public/images/captcha',
'GcFreq'=>'5'
)));
任何人都可以帮助我吗?
I am using zend captcha in zend form. it's working properly, but when it creates then it generate this code:
<img width="80" height="30" alt="Allindia captcha" src="/allindiazend/public/images/captcha/4ae305b05406c9d8b06a19ea7ff2c9d9.png"/><br/>
<input type="hidden" name="captcha[id]" value="4ae305b05406c9d8b06a19ea7ff2c9d9" title="Security Check." id="captchas" />
<input type="text" name="captcha[input]" id="captchas" value="" title="Security Check." />
The text box is occur below the img due to this <br/>
. I dont want this 'br' tag in the generated code.
this is my code for captcha:
$captcha= new Zend_Form_Element_Captcha('captcha', array(
'id'=>'captchas',
'title'=>'Security Check.',
'captcha' => array(
'captcha' => 'Image',
'required' => true,
'font'=>'arial.ttf',
'wordlen'=>'4',
'width'=>'80',
'height'=>'30',
'ImgAlign'=>'left',
'imgdir'=>'public/images/captcha',
'DotNoiseLevel'=>'0',
'LineNoiseLevel'=>'0',
'Expiration'=>'1000',
'fontsize'=>'16',
'gcFreq'=>'10',
'ImgAlt'=>'Allindia captcha',
'imgurl'=>'/allindiazend/public/images/captcha',
'GcFreq'=>'5'
)));
can any one help me plz.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这与验证码本身的配置无关,但与表单元素有关。我猜这个
被添加到Zend_Form_Element_Captcha
的任何默认装饰器中。查看哪些装饰器附加到表单,如下所示:您将看到所有装饰器。尝试逐步删除所有装饰器,看看它们中的哪一个生成
。完全删除它,或者如果有必要,使用您自己的装饰器覆盖它,省略
。This doesn't have to do anything with the configuration of the captcha itself, but with the form-element. I guess that this
<br />
is added in any of the default decorators ofZend_Form_Element_Captcha
. Look which decorators are attached to the form like this:You'll see all decorators. Try removing all decorators step by step to see which of them generates the
<br />
. Remove it completly or if it is necessary override it with your own decorator omitting the<br />
.我通常会做这样的事情,
摆脱默认的装饰器并创建空白的装饰器
I usually do something like this
gets rid of the default Decorators and creates blank ones