Php Zend验证码html
我正在使用Php Zend验证码html,php,html,zend-framework,decorator,captcha,Php,Html,Zend Framework,Decorator,Captcha,我正在使用Zend\u表单创建这样的验证码: class Form_Signup extends Zend_Form { public function __construct( array $options = null ) { // set method $this->setMethod('post'); // other elements here // captcha
Zend\u表单创建这样的验证码:
class Form_Signup extends Zend_Form {
public function __construct( array $options = null ) {
// set method
$this->setMethod('post');
// other elements here
// captcha
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'id'=>'captcha',
'title'=>'Security Check.',
'captcha' => array(
'captcha' => 'Image',
'required' => true,
'font'=> 'fonts/ARIALN.TTF',
'wordlen'=>'4',
'width'=>'200',
'height'=>'50',
'ImgAlign'=>'left',
'DotNoiseLevel'=>'30',
'LineNoiseLevel'=>'7',
'Expiration'=>'1000',
'fontsize'=>'30',
'gcFreq'=>'10',
'imgdir'=> 'images/captcha/',
'ImgAlt'=>'Captcha',
'imgurl'=>'/images/captcha/'
)));
$captcha->removeDecorator('HtmlTag')
->removeDecorator('Label')
->addDecorator('Label');
// add captcha
$this->addElement( $captcha );
$this->setDecorators( array( array( 'ViewScript', array( 'viewScript' => 'signup/signup-form.phtml' ) ) ) );
}
}
它生成的HTML如下所示:
<img width="200" height="50" alt="Captcha" src="/images/captcha/cabf4d4d759ae8e4b7404b95e032e231.png">
<input type="hidden" name="captcha[id]" value="cabf4d4d759ae8e4b7404b95e032e231" title="Security Check." id="captcha">
<input type="text" name="captcha[input]" id="captcha" value="" title="Security Check.">
但我希望在图像下方显示验证码文本框,如下所示:
<img width="200" height="50" alt="Captcha" src="/images/captcha/cabf4d4d759ae8e4b7404b95e032e231.png">
<br />
<input type="hidden" name="captcha[id]" value="cabf4d4d759ae8e4b7404b95e032e231" title="Security Check." id="captcha">
<input type="text" name="captcha[input]" id="captcha" value="" title="Security Check.">
有什么想法吗
谢谢Zend验证码元素装饰程序很少完成。解决这个问题的最好办法是创建我们自己的装饰师。一旦你完成了。您可以根据需要更改订单
你可以找到完整的答案
如果你不着急,如果你有足够的时间,那么请通过我来解释如何与装饰师一起玩
我问了一个几乎相同的问题,我不想创建一个单独的decorator类,但没有得到任何正确的答案。然后我做了一些css技巧,强迫
下载。所以,唯一的解决方案是生成自定义captcha装饰器类
如果你在那里什么都没有,那就告诉我。谢谢可能的副本