Posted By

guimarca on 12/04/15


Tagged

php YII2


Versions (?)

Yii2 signup captcha


 / Published in: PHP
 

First, for SignUp Model.

Second, for signup view.

  1. public $verifyCode;
  2. ['verifyCode', 'captcha'],
  3. ['verifyCode', 'required'],
  4.  
  5.  
  6. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  7. 'template' => '<div class="row"><div class="col-lg-4">{image}</div><div class="col-lg-6">{input}</div></div>',
  8. ]) ?>
  9. <div style="color:#999;margin:1em 0">
  10. <?= Yii::t('app', 'Click on the image to get a new verification code.') ?>
  11. </div>

Report this snippet  

You need to login to post a comment.