YII 框架 第七天(2) 驗(yàn)證碼
驗(yàn)證碼使用步驟:
1.?????在控制器設(shè)置actions方法
????????public?function?actions()
????????{
????????????return?array(
????????????????'captcha'=>array(
????????????????????'class'=>'system.web.widgets.captcha.CCaptchaAction',
????????????????????'width'=>75,
????????????????????'height'=>30,
????????????????????'minLength'=>4,
????????????????????'maxLength'=>4
????????????????)
????????????);
????????}2.?????在表單里邊通過(guò)widget顯示驗(yàn)證碼
????????????????????????????????labelEx($user_login,'verifyCode');?>textField($user_login,'verifyCode',array('size'=>8,'maxlength'=>4));?>widget('CCaptcha');?>???error($user_login,'verifyCode');?>3.?????在模型里邊通過(guò)captcha校驗(yàn)驗(yàn)證碼
?
array('verifyCode','captcha','message'=>'請(qǐng)輸入正確的驗(yàn)證碼'), ?間接通過(guò)CcaptchaAction進(jìn)行校驗(yàn)。





