本文整理汇总了PHP中yii\captcha\Captcha::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::className方法的具体用法?PHP Captcha::className怎么用?PHP Captcha::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\captcha\Captcha
的用法示例。
在下文中一共展示了Captcha::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
$form = ActiveForm::begin(['id' => 'contact-form', 'action' => '/contact']);
?>
<?php
echo $form->field($model, 'email')->textInput(['placeholder' => 'email'])->label(false);
?>
<div class="clear" style="height:20px"></div>
<?php
echo $form->field($model, 'subject')->textInput(['placeholder' => 'тема'])->label(false);
?>
<div class="clear" style="height:20px"></div>
<?php
echo $form->field($model, 'body')->textArea(['rows' => 6])->label(false);
?>
<div class="clear" style="height:20px"></div>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', 'options' => ['placeholder' => 'введите код']])->label(false);
?>
<div class="clear" style="height:20px"></div>
<div class="form-group">
<?php
echo Html::submitButton('Отправить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
?>
</div>
<div class="clear" style="height:16px"></div>
<span class="form_hint">Чтобы закрыть форму нажмите ESC</span>
<?php
ActiveForm::end();
?>
</div>
示例2:
<div class="col-lg-5">
<?php
$form = ActiveForm::begin(['id' => 'form-signup']);
?>
<?php
echo $form->field($model, 'username');
?>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'repassword')->passwordInput();
?>
<?php
echo $form->field($model, 'verifyCode', ['options' => ['class' => 'form-group form-group-lg']])->widget(Captcha::className(), ['template' => "{input}{image}", 'imageOptions' => ['alt' => '验证码']]);
?>
<div class="form-group">
<?php
echo Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
</div>
示例3:
<div class="login text-center">
<div class="login-form col-lg-5">
<div class="panel panel-default text-left">
<div class="panel-heading"><strong>登录</strong></div>
<div class="panel-body">
<?php
$form = ActiveForm::begin(['id' => 'login', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['labelOptions' => ['class' => 'col-lg-2 control-label'], 'template' => "{label}<div class='col-lg-8'>{input}\n{error}</div>"]]);
?>
<?php
echo $form->field($model, 'username');
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'captcha')->widget(Captcha::className(), ['imageOptions' => ['class' => 'captcha'], 'template' => "<div class='row'><div class='col-lg-4'>{image}</div><div class='col-lg-8'>{input}</div></div>"]);
?>
<div class="form-group">
<div class="col-lg-2"></div>
<div class="col-lg-7">
<?php
echo Html::submitButton('登 录', ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
</div>
示例4:
<div id="slide-content2" class="row" style="margin: 0; padding: 0;">
<div class="mail" style="">
<?php
echo $form->field($model, 'username', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-username-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Username']])->label(false);
?>
<?php
echo $form->field($model, 'email', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-mail-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Email']])->label(false);
?>
<?php
echo $form->field($model, 'password', ['inputTemplate' => '{input}', 'inputOptions' => ['id' => 'input-password-check', 'style' => 'margin-bottom: -10px;', 'class' => 'form-control pva-border', 'placeholder' => 'Password']])->passwordInput()->label(false);
?>
</div>
<div class="vfy" style="">
<?php
echo $form->field($model, 'verifyCode')->label(false)->widget(Captcha::className(), ['template' => '<div class="display: inline;"><label class="pull-left" style="color: white;">Captcha Code: </label><div class="text-right">{image}</div><div style="margin-top: 25px; margin-bottom: 25px; color: white;">* * Click image to generate new captcha code</div></div><p></p>{input}']);
?>
</div>
</div>
</div>
</div>
<div class="slide-btn">
<button type="button" id="btn-info-check" class="btn btn-primary btn-block pva-border" style="height: 46px; background: #337AB7; border: 0;" data-toggle="modal" data-target="#verify">NEXT</button>
</div>
</div>
<p id="msg-info-check" style="color: white; font-size: 16px; margin-top: 20px;"></p>
</div>
</div>
</div>
</div>
</div>
示例5:
<div class="col-sm-7">
<p><?php
echo Module::t('site', 'CONTACTS_FORM_INFO');
?>
</p>
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'name');
?>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'subject');
?>
<?php
echo $form->field($model, 'body')->textArea(['rows' => 6]);
?>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => '/site/default/captcha', 'options' => ['class' => 'form-control'], 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-9">{input}</div></div>']);
?>
<?php
echo Html::submitButton(Module::t('site', 'CONTACTS_SUBMIT_BTN'), ['class' => 'btn btn-primary btn-lg']);
?>
<?php
ActiveForm::end();
?>
</div>
</div>
示例6:
<p>Please fill out the following fields to login:</p>
<?php
$form = ActiveForm::begin(['id' => 'login-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-1 control-label']]]);
?>
<?php
echo $form->field($model, 'username');
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'captcha')->widget(Captcha::className());
?>
<?php
echo $form->field($model, 'rememberMe', ['template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>"])->checkbox();
?>
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<?php
echo Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
</div>
</div>
<?php
示例7: initClassMap
/**
* Initializes the class map.
*/
protected function initClassMap()
{
$this->classMap = ArrayHelper::merge([self::CLASS_ACCOUNT => Account::className(), self::CLASS_TOKEN => AccountToken::className(), self::CLASS_PROVIDER => AccountProvider::className(), self::CLASS_LOGIN_HISTORY => AccountLoginHistory::className(), self::CLASS_PASSWORD_HISTORY => AccountPasswordHistory::className(), self::CLASS_LOGIN_FORM => LoginForm::className(), self::CLASS_PASSWORD_FORM => PasswordForm::className(), self::CLASS_SIGNUP_FORM => SignupForm::className(), self::CLASS_CONNECT_FORM => ConnectForm::className(), self::CLASS_FORGOT_PASSWORD_FORM => ForgotPasswordForm::className(), self::CLASS_WEB_USER => User::className(), self::CLASS_CAPTCHA => Captcha::className(), self::CLASS_CAPTCHA_ACTION => CaptchaAction::className(), self::CLASS_PASSWORD_BEHAVIOR => PasswordAttributeBehavior::className(), self::CLASS_PASSWORD_VALIDATOR => PasswordStrengthValidator::className()], $this->classMap);
}
示例8:
<!--账号-->
<?php
echo $form->field($model, 'username', ['inputOptions' => ['placeholder' => '请输入用户名', 'class' => 'input-text size-L'], 'template' => '<div class="row cl"><label class="form-label col-3"><i class="Hui-iconfont"></i></label><div class="formControls col-8">{input}{error}</div></div>'])->textInput();
?>
<!--密码-->
<?php
echo $form->field($model, 'password', ['inputOptions' => ['placeholder' => '请输入密码', 'class' => 'input-text size-L'], 'template' => '<div class="row cl"><label class="form-label col-3"><i class="Hui-iconfont"></i></label><div class="formControls col-8">{input}{error}</div></div>'])->passwordInput();
?>
<!--验证码-->
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row cl"><div class="formControls col-8 col-offset-3" id="verify-div">{image}<span id="imgcode">{input}</span></div></div>', 'imageOptions' => ['alt' => '验证码'], 'captchaAction' => 'login/captcha', 'options' => ['placeholder' => '请输入验证码', 'class' => 'input-text size-L', 'id' => 'verify']]);
?>
<!--登陆-->
<div class="row">
<div class="formControls col-8 col-offset-3">
<?php
echo Html::submitButton('登陆', ['class' => 'btn btn-success radius size-L']);
?>
<?php
echo Html::resetButton('重置', ['class' => 'btn btn-default radius size-L']);
?>
</div>
</div>
示例9:
$form = ActiveForm::begin(['id' => 'contact-form']);
?>
<?php
echo $form->field($model, 'name')->label('Ваше имя');
?>
<?php
echo $form->field($model, 'email')->label('Email');
?>
<?php
echo $form->field($model, 'subject')->label('Тема');
?>
<?php
echo $form->field($model, 'body')->textArea(['rows' => 6])->label('Сообщение');
?>
<?php
echo $form->field($model, 'verifyCode')->hint('Введите код указанный на картинке')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>']);
?>
<div class="form-group">
<?php
echo Html::submitButton('Отправить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
<?php
}
?>
示例10:
echo $form->field($model, 'name', ['template' => "<i class=\"material-icons prefix\">account_box</i>{$template}", 'options' => ['class' => 'input-field col s12']]);
?>
</div>
<div class="row">
<?php
echo $form->field($model, 'email', ['template' => "<i class=\"material-icons prefix\">email</i>{$template}", 'options' => ['class' => 'input-field col s12']]);
?>
</div>
<div class="row">
<?php
echo $form->field($model, 'message', ['template' => "<i class=\"material-icons prefix\">mode_edit</i>{$template}", 'options' => ['class' => 'input-field col s12'], 'inputOptions' => ['class' => 'materialize-textarea']])->textarea();
?>
</div>
<div class="row">
<?php
echo $form->field($model, 'verifyCode', ['template' => "{input}\n{label}\n{hint}\n{error}", 'options' => ['class' => 'input-field col s12 m6']])->widget(Captcha::className(), ['imageOptions' => ['class' => 'captcha-prefix responsive-img']]);
?>
</div>
<div class="row">
<div class="col s12">
<?php
echo Html::submitButton('<i class="material-icons right">send</i>' . Yii::t('front', 'Submit'), ['class' => 'btn waves-effect waves-light', 'name' => 'message-button']);
?>
</div>
</div>
<?php
MaterializeActiveForm::end();
?>
<?php
示例11:
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<p><?php
echo Yii::t('user', 'Enter your e-mail. On it will be sent a link to reset your password.');
?>
</p>
</div>
</div>
<fieldset>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['options' => ['class' => 'form-control', 'autocomplete' => 'off'], 'captchaAction' => ['/site/captcha'], 'template' => '<div class="captcha">{image}<div>{input}</div></div>']);
?>
</fieldset>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<?php
echo Html::submitButton(Yii::t('user', 'Send'), ['class' => 'btn btn-primary', 'name' => 'reset-button']);
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<?php
echo Yii::t('user', 'You know your password?');
示例12:
<?php
echo $form->field($model, 'username')->textInput(['placeholder' => '请输入用户名']);
?>
<?php
echo $form->field($model, 'password')->passwordInput(['placeholder' => '请输入密码']);
?>
<?php
$template = <<<STD
<div class="form-group field-user-password required has-error">
<div class="col-lg-6">{input}</div>
<label class="col-lg-3 control-label" for="user-password">{image}</label>
</div>
STD;
echo $form->field($model, 'captcha')->widget(Captcha::className(), ['captchaAction' => '/admin/public/captcha', 'template' => $template, 'imageOptions' => ['style' => 'width: 80px; height: 30px;']]);
?>
<div class="form-group">
<!--<input type="submit" value="登录" class="btn btn-success center-block">-->
<div class="col-lg-offset-3 col-lg-11">
<?php
echo Html::submitInput('登录', ['class' => 'btn btn-success ']);
?>
</div>
</div>
</div>
<?php
\yii\widgets\ActiveForm::end();
示例13:
<div class="container">
<div class="login">
<div class="login-head">欢迎来到名坡绿茶,我们将竭诚为你服务。</div>
<div class="login-con">
<?php
$form = ActiveForm::begin(['id' => 'login-form', 'options' => ['class' => 'login-form']]);
?>
<?php
echo $form->field($model, 'mobile')->textInput(['class' => 'login-text', 'placeholder' => '手机号码/昵称'])->label('');
?>
<?php
echo $form->field($model, 'password')->passwordInput(['class' => 'login-paw', 'placeholder' => '密码'])->label('');
?>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div>{image}{input}</div>', 'imageOptions' => ['alt' => '验证码', 'class' => 'login-obtain'], 'captchaAction' => 'site/captcha', 'options' => ['class' => 'login-yzm', 'placeholder' => '验证码']])->label('');
?>
<?php
echo Html::submitInput('登录', ['class' => 'login-btn', 'name' => 'login-button']);
?>
<?php
ActiveForm::end();
?>
<a href="<?php
echo \common\widgets\FVariable::$siteForgetpsw_url;
?>
" class="login-forget">忘记密码?</a>
<div class="login-bottom">
还没有账号?<a href="<?php
echo \common\widgets\FVariable::$siteRegister_url;
?>
示例14:
?>
<?php
echo $form->field($model, 'email')->label(Yii::t('adminlte', 'Email'));
?>
<?php
echo $form->field($model, 'subject')->label(Yii::t('adminlte', 'Subject'));
?>
<?php
echo $form->field($model, 'body')->textArea(['rows' => 6])->label(Yii::t('adminlte', 'Body'));
?>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>'])->label(Yii::t('adminlte', 'Verification Code'));
?>
<?php
echo Html::beginTag('div', ['class' => 'footer']);
?>
<?php
echo Html::submitButton(Yii::t('adminlte', 'Submit'), ['class' => 'btn bg-black btn-block', 'name' => 'contact-button']);
?>
<?php
echo Html::endTag('div');
?>
<?php
ActiveForm::end();
?>
<?php
示例15:
</div>
<?php
}
?>
<div class="uk-width-medium-4-10 uk-form-row">
<?php
echo $form->field($respond, 'author')->textInput(['class' => 'uk-width-large', 'placeholder' => 'Имя'])->label(false);
?>
<?php
echo $form->field($respond, 'email')->textInput(['class' => 'uk-width-large', 'placeholder' => 'E-mail'])->label(false);
?>
</div>
<div class="uk-width-medium-2-10 uk-form-row">
<div id="captcha">
<?php
echo $form->field($respond, 'captcha')->widget(Captcha::className(), ['captchaAction' => '/comments/captcha'])->label(false);
?>
</div>
</div>
<?php
}
?>
<div class="uk-width-medium-4-10 uk-form-row">
<?php
echo Html::submitButton('Отправить комментарий', ['class' => 'uk-width-1-1 uk-button uk-button-success']);
?>
</div>
<div class="uk-width-medium-4-10 uk-form-row">
<a class="dfn uk-hidden" href="#respond" data-reply-main>в новой ветке</a>
</div>
</div>