本文为大家分享了yii2.0实现验证用户名与邮箱功能的相关代码,具体内容如下
视图signup.PHP代码:
PHP;">
/ @var $this yii\web\View /
/ @var $form yii\bootstrap\ActiveForm /
/ @var $model \frontend\models\SignupForm /
/ @var $form yii\bootstrap\ActiveForm /
/ @var $model \frontend\models\SignupForm /
$this->title = '注册';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-signup">
= Html::encode($this->title) ?>
Please fill out the following fields to signup:
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin([
'id' => 'form-signup','enableAjaxValidation' => true,'enableClientValidation' => true,]); ?>
<?= $form->field($model,'username') ?>
<?= $form->field($model,'email') ?>
<?= $form->field($model,'password')->passwordInput() ?>
<?= $form->field($model,'password_compare')->passwordInput() ?>
<div class="form-group">
<?= Html::submitButton('Signup',['class' => 'btn btn-primary','name' => 'signup-button']) ?>
</div>
<?php ActiveForm::end(); ?>