Yii中的验证码仅在图像刷新时才起作用

时间:2015-02-05 12:07:22

标签: php yii captcha

如果我正确地写了所有数据以及图像中的验证代码,它就不起作用,它告诉我验证码不正确。之后图像被更改,我再次将其写入验证码并且它可以工作。我的问题是为什么?我该怎么办? 这是模型的规则:  我

f ($this->scenario == "insert") {
            return array(
                array('requisition_id, sync', 'numerical', 'integerOnly' => true),
                array('lastname, firstname, email, dob, phone, cv_path, experienceMonths, experienceYears, competencies, token', 'required', 'message' => "invalid"),
                array('email', 'email', 'message' => "Emailul este invalid!"),
                array('dob', 'validateDob'),
                array('dayOfBirth, monthOfBirth, yearOfBirth', 'safe'),
                array('taleo_id, sync', 'required', 'on' => 'taleoUpdate'),
                array('verifyCode', 'captcha', 'captchaAction'=>'site/captcha') 
               // array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(),'on' => 'register')
            );
        } else if ($this->scenario == 'taleoUpdate') {
            return array(
                array('taleo_id, sync', 'required'),
            );
        }
        else if($this->scenario == 'notjobapply'){
            return array(
                array('lastname, firstname, email, phone, cv_path, requisition_id', 'required', 'message'=>'Câmpul este obligatoriu'),
                array('email', 'email', 'message' => "Emailul este invalid!"),
            );
        }

这是视图

$this->widget('CCaptcha', 
                    array(
                        'captchaAction' =>'site/captcha',
                        'buttonOptions' => array('class'=>'test','style' => 'display:block'),
                    )
                ); 
<?php echo $form->textField($applicant,'verifyCode',array('class' => 'captcha', 'placeholder' => 'Captcha')); ?>
 <?php echo $form->error($applicant,'verifyCode', array(), false, false); ?>

0 个答案:

没有答案