yii 인증코드는 모델을 사용하지 않고 컨트롤러에서 검증합니다

2222 단어 Model
 

public function actionCheckLogin(){



if(!$this->createAction('verify_code')->validate($_POST['verfiy_code'], false)){

                $error = ' ';

            }

}
/*
           $captch= new CCaptchaAction($this,'verify_code');
echo $right = $captch->getVerifyCode();

*/
public function actions(){ return array( 'verify_code' => array( 'class' => 'CCaptchaAction', 'backColor'=>0xFFFFFF, 'minLength' => 4, 'maxLength' => 4, 'width' => 78, 'height' => 30, ), ); }
 



<a class="code-img">

<?php $this->widget('CCaptcha', array('captchaAction' => 'verify_code', 'imageOptions'=>array('class' => 'verfiy_code'), 'buttonOptions' => array('class' => 'refresh_verfiy_code'), 'buttonLabel' => '<br> '));?>

</a>

좋은 웹페이지 즐겨찾기