我正在使用以下方法创建这样的验证码Zend_Form
:
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.">
任何想法 ?
谢谢