• yii验证码不使用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>
  • 相关阅读:
    PCRE
    [转]如何解决严重的拖延症
    linux系统编程:setjmp和longjmp函数用法
    AWK中几个变量
    关于fork函数
    go mod
    golang+read_file+call_shell+goroutine
    vim for galang
    Linux install go
    为Git branch 打Tag
  • 原文地址:https://www.cnblogs.com/jami918/p/3781518.html
Copyright © 2020-2023  润新知