zoukankan      html  css  js  c++  java
  • yii 创建 验证码

    转载地址: http://blog.sina.com.cn/s/blog_664c9f650100wkmp.html

    1,在SiteController action()下:
    return array(
                            // captcha action renders the CAPTCHA image displayed on the contact page
                            'captcha'=>array(
                                    'class'=>'CCaptchaAction',
                                    'backColor'=>0xFFFFFF,
                            ),
                            // page action renders "static" pages stored under 'protected/views/site/pages'
                            // They can be accessed via: index.php?r=site/page&view=FileName
                            'page'=>array(
                                    'class'=>'CViewAction',
                            ),
                    );
    2、(1)在LoginForm model rules()下添加:
                //captche class needed
    array('verifyCode', 'captcha','allowEmpty'=>!CCaptcha::checkRequirements()),
      
        (2)LoginForm model下添加属性:
            public $verifyCode;
        
    3、在ContactForm model rules()下添加:
    // verifyCode needs to be entered correctly
    array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),


    4、在login view下添加:
    <div class="row">
           <?php echo $form->labelEx($model,'verifyCode'); ?>
    <?php $this->widget('CCaptcha'); ?>
    <?php echo $form->textField($model,'verifyCode'); ?>
    <?php echo $form->error($model,'verifyCode'); ?>
    </div>

    Meet so Meet. C plusplus I-PLUS....
  • 相关阅读:
    关键词提取算法TextRank
    我的博文目录整理
    Windows Azure一些小技巧集合
    js数组和树互转
    this.props.form.validateFields回调不执行问题
    d3的4.x与3.x版本的区别
    d3提示框,虚线,选择区域
    d3布局
    d3文件导入和导出
    d3交互
  • 原文地址:https://www.cnblogs.com/iplus/p/4489991.html
Copyright © 2011-2022 走看看