本文整理汇总了PHP中yii\captcha\Captcha::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::widget方法的具体用法?PHP Captcha::widget怎么用?PHP Captcha::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\captcha\Captcha
的用法示例。
在下文中一共展示了Captcha::widget方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<div class="form-group">
<?php
//echo $form->labelEx($model, 'email');
?>
<?php
echo $form->textField($model, 'email', array('class' => 'form-control', 'id' => 'email_txt', 'placeholder' => Yii::t('UserModule.views_auth_recoverPassword', 'your email')));
?>
<?php
echo $form->error($model, 'email');
?>
</div>
<div class="form-group">
<?php
echo \yii\captcha\Captcha::widget(['model' => $model, 'attribute' => 'verifyCode', 'captchaAction' => '/user/auth/captcha', 'options' => array('class' => 'form-control', 'placeholder' => Yii::t('UserModule.views_auth_recoverPassword', 'enter security code above'))]);
?>
<?php
echo $form->error($model, 'verifyCode');
?>
</div>
<hr>
<?php
echo \humhub\widgets\AjaxButton::widget(['label' => Yii::t('UserModule.views_auth_recoverPassword', 'Reset password'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'), 'success' => 'function(html){ $("#globalModal").html(html); }', 'url' => Url::to(['/user/password-recovery'])], 'htmlOptions' => ['class' => 'btn btn-primary', 'id' => 'recoverPasswordBtn']]);
echo \humhub\widgets\AjaxButton::widget(['label' => Yii::t('UserModule.views_auth_recoverPassword', 'Back'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'), 'success' => 'function(html){ $("#globalModal").html(html); }', 'url' => Url::to(['/user/auth/login'])], 'htmlOptions' => ['class' => 'btn btn-primary', 'id' => 'backBtn']]);
?>
<?php
CActiveForm::end();
?>
</div>
示例2:
$form = ActiveForm::begin();
?>
<div class="login" style="padding-top:84px;height:510px;">
<div class="findPassword"
style="width:823px;height:436px;background:url(../images/Newpabj.jpg) no-repeat;margin:0 auto;padding-top:45px;">
<div class="stepBox"><img src="/images/step1.png"/></div>
<div class="padNew">
<table cellpadding="0" cellspacing="0" class="newsTable">
<tr>
<td valign="top" style="line-height:34px;">账户名:</td>
<td><input type="text" name="username" value="已验证手机/邮箱" class="w185" onfocus="this.value = '';"
onblur="if (this.value == '') {this.value = '已验证手机/邮箱';}"/><b>请输入您的验证手机或邮箱</b></td>
</tr>
<tr>
<?php
echo Captcha::widget(['name' => 'verifyCode', 'captchaAction' => 'find-password/captcha', 'imageOptions' => ['title' => '换一个', 'alt' => '换一个'], 'template' => '<td align="right">验证码:</td><td><input type="text" class="w188" name="verifyCode" /><div class="col-lg-3">{image}</div></td>']);
?>
</tr>
<tr>
<td></td>
<td><input type="submit" value="提 交" class="tjButton"/></td>
</tr>
</table>
</div>
</div>
</div>
<?php
ActiveForm::end();
?>
示例3: foreach
if ($group->hidden_group_title == 0) {
?>
<h4><?php
echo $group->name;
?>
</h4>
<?php
}
?>
<?php
$properties = Property::getForGroupId($group->id);
?>
<?php
foreach ($properties as $property) {
?>
<?php
if ($property->captcha) {
echo Captcha::widget(['model' => $model->abstractModel, 'attribute' => $property->key, 'captchaAction' => ['/default/captcha']]);
} else {
echo $property->handler($form, $model->abstractModel, [], 'frontend_edit_view');
}
?>
<?php
}
?>
<?php
}
?>
<?php
echo \kartik\helpers\Html::submitButton(Yii::t('app', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
示例4:
<?}?>
<div class="clear" style="height:28px"></div>
<form method="post" id="add_comment" action="/comment/default/create">
<input type="hidden" name="_csrf" value="<?php
echo Yii::$app->request->getCsrfToken();
?>
">
<input type="hidden" name="parent_id" value="<?php
echo $parent_id;
?>
">
<input type="hidden" name="type" value="<?php
echo $type;
?>
">
<input type="hidden" name="back_url" value="<?php
echo Url::current();
?>
">
<div id="add_comment_title">Оставить сообщение</div>
<div class="clear" style="height:28px"></div>
<input type="text" name="user_name" placeholder="имя">
<div class="clear" style="height:18px"></div>
<textarea name="text">сообщение</textarea>
<div class="clear" style="height:22px"></div>
<?php
echo Captcha::widget(['name' => 'captcha', 'template' => '{image}<div class="clear" style="height:28px"></div>{input}', 'options' => ['placeholder' => 'введите код']]);
?>
<div class="clear" style="height:22px"></div>
<input type="submit" value="Отправить">
</form>
示例5: run
public function run()
{
$this->getView()->registerJs("\n \$('#verifycode-hint').on('click', function(){\n \$('#verifycode-image').trigger('click');\n });\n ");
return YiiCaptcha::widget(['model' => $this->model, 'attribute' => $this->attribute, 'captchaAction' => '/captcha/default/index', 'template' => '{input}{image}' . $this->renderReloader(), 'options' => ['class' => 'form-control'], 'imageOptions' => ['id' => 'verifycode-image', 'alt' => 'Код безопасности', 'class' => 'captcha-image']]);
}
示例6: date
<table style="width:330px;margin:0 auto;">
<tr>
<td style="padding-bottom:15px;padding-right: 10px;font-weight: bold; width:45;text-align: right;">帐<span style="display: inline-block;height:1px;width:1em;"></span>号 :</td>
<td style="padding-bottom:15px;"><input class="easyui-validatebox inputText" style="width:185px;" type="text" id="username" name="username" data-options="required:true,validType:'length[5,30]'" value=""></input>
</td>
</tr>
<tr>
<td style="padding-bottom:15px;padding-right: 10px;font-weight: bold; width:45;text-align: right;">密<span style="display: inline-block;height:1px;width:1em;"></span>码 :</td>
<td style="padding-bottom:15px;"><input style="width:185px;" class="inputText easyui-validatebox" type="password" id="password" name="password" data-options="required:true,validType:'length[6,30]'"></input></td>
</tr>
<tr>
<td style="padding-bottom:15px;padding-right: 10px;font-weight: bold; width:45;text-align: right;">验证码 :</td>
<td style="padding-bottom:15px;">
<input class="easyui-validatebox inputText" placeholder="验证码" name="verifyCode" id="verifyCode" style="width:100px;float: left"/>
<?php
echo Captcha::widget(['name' => 'verifyCode', 'captchaAction' => 'admin/captcha', 'imageOptions' => ['alt' => '验证码', 'style' => 'cursor:pointer;float:left'], 'template' => "{image}"]);
?>
</td>
</tr>
<tr>
<td style="padding-bottom:15px;padding-right: 10px;font-weight: bold; width:45;text-align: right;"> </td>
<td style="padding-bottom:15px;"><a href="javascript:void(0)" class="loginBtn" onclick="submitForm()"></a> </td>
</tr>
</table>
</form>
</div>
</div>
<div class="footer">
<p style="margin-top:38px;text-align: center;">Copyright © 创扬科技 2015 - <?php
echo date('Y', time());
?>
示例7:
<?php
echo Html::activeTextInput($model, 'username', ['class' => 'user-text', 'placeholder' => '请输入用户名或邮箱']);
?>
</div>
<div class="login-mm">密码:
<?php
echo Html::activePasswordInput($model, 'password', ['class' => 'password-text', 'placeholder' => '请输入密码']);
?>
</div>
<div class="yzm">验证码:
<?php
echo Html::activeTextInput($model, 'captcha', ['class' => 'yzm-text', 'placeholder' => '请输入验证码']);
?>
<span class="yzm-pic">
<?php
echo Captcha::widget(['name' => 'captcha', 'template' => '{image}']);
?>
</span>
</div>
<?php
echo Html::errorSummary($model, ['class' => 'regerror error-tips']);
?>
<div class="c-login" style="margin-top:30px;"><input type="submit" class="c-login-button" value="立即登录"></div>
<?php
ActiveForm::end();
?>
<div class="forget">
<a href="<?php
echo Yii::$app->urlManager->createUrl(['site/reg']);
?>
示例8: renderCaptcha
private function renderCaptcha()
{
if ($this->_config['useCaptcha']) {
return Html::tag('div', Html::label('Введите символы с картинки')) . Html::tag('div', Captcha::widget(['name' => 'captcha', 'options' => ['required' => true]]));
}
return '';
}
示例9:
echo Html::activeInput('email', $model, 'email', ['class' => 'txt']);
?>
</li>
<li>
<?php
echo Html::activeLabel($model, 'password');
?>
<?php
echo Html::activeInput('password', $model, 'password', ['class' => 'txt']);
?>
<a href="">忘记密码?</a>
</li>
<li class="checkcode">
<label for="">验证码:</label>
<?php
echo Captcha::widget(['model' => $model, 'attribute' => 'captcha', 'template' => '{image} {input}', 'captchaAction' => 'user/captcha', 'options' => ['id' => 'captcha']]);
?>
<span>看不清?<a href="javascript:" id='refresh-captcha'>换一张</a></span>
</li>
<li>
<label for=""> </label>
<?php
echo Html::activeInput('checkbox', $model, 'rememberMe', ['class' => 'chb']);
?>
保存登录信息
</li>
<li>
<label for=""> </label>
<input type="submit" value="" class="login_btn" />
</li>
</ul>
示例10: foreach
<p>
<label>用户名:</label>
<input type="text" name="LoginForm[username]" size="20" class="login_input" />
</p>
<p>
<label>密码:</label>
<input type="password" name="LoginForm[password]" size="20" class="login_input" />
</p>
<p>
<label>验证码:</label>
<input class="code" type="text" size="5" name="LoginForm[verifyCode]" />
<!-- <span><img src="themes/default/images/header_bg.png" alt="" width="75" height="24" /></span>-->
<span>
<?php
echo Captcha::widget(['name' => 'user[captcha]', 'class' => Captcha::className(), 'id' => 'login-captcha', 'template' => '{image}', 'captchaAction' => '/user/common/captcha']);
?>
</span>
<?php
$allFlashes = Yii::$app->session->getAllFlashes();
if (!empty($allFlashes['error'])) {
foreach ($allFlashes['error'] as $flash) {
if (is_array($flash)) {
foreach ($flash as $key => $val) {
echo '<p style="color: red;">' . $val . '</p>';
}
} else {
echo '<p style="color: red;">' . $flash . '</p>';
}
}
示例11:
</div>
<div class="row clearfix">
<div class="frm-icon-field">
<span class="wrap-icon fa fa-briefcase"></span><input type="text" name="Contact[subject]" placeholder="Subject *">
</div>
<span class="error" cmt-error="subject"></span>
</div>
<div class="row clearfix">
<div class="frm-icon-field">
<span class="wrap-icon fa fa-folder icon-textarea"></span><textarea name="Contact[message]" placeholder="Message *"></textarea>
</div>
<span class="error" cmt-error="message"></span>
</div>
<div class="row clearfix">
<?php
echo Captcha::widget(['name' => 'Contact[captcha]', 'captchaAction' => '/cmgforms/site/captcha']);
?>
<span class="error" cmt-error="captcha"></span>
</div>
<div class="row clearfix">
<input type="submit" name="submit" placeholder="Message" value="Submit">
</div>
<div class="row clearfix">
<div class="message warning"></div>
</div>
</form>
</div>
<div class="col3">
<h6>Address</h6>
<p>
示例12:
<?php
use yii\captcha\Captcha;
?>
<div class='frm-field wrap-captcha'>
<?php
echo Captcha::widget(['name' => 'GenericForm[captcha]', 'captchaAction' => '/cmgforms/site/captcha', 'options' => ['placeholder' => 'Captcha Key*']]);
?>
<span class="warning">Click on the captcha image to get new code.</span>
<span class="error" cmt-error="captcha"></span>
</div>
示例13:
<div class="col-md-12 text-center"><h1>Контактные данные</h1></div>
<div class="col-md-12">
<div class="form-group">
<label for="c-name" class="require">Ваше Имя</label>
<input class="form-control" id="c-name" type="text" name="c_name" placeholder="Введите имя">
</div>
<div id="c-name-hint" class="col-md-12 error-hint"></div>
<div class="form-group">
<label for="c-name" class="require">Ваш Телефон</label>
<input class="form-control" id="c-phone" type="text" name="c_phone" placeholder="Введите телефон">
</div>
<div id="c-phone-hint" class="col-md-12 error-hint"></div>
</div>
<div class="form-group">
<?php
echo Captcha::widget(['captchaAction' => 'shop/captcha', 'name' => 'captcha', 'template' => '<div class="col-md-12">{image}</div><label for="w0" class="col-md-12"><b>Введите код на картинке</b></label><div class="col-md-6">{input}</div>']);
?>
</div>
<div class="col-md-4 col-md-offset-8">
<div class="cart-button">
<?php
echo \yii\helpers\Html::submitButton('Подтвердить заказ', ['class' => 'btn btn-primary btn-lg btn-block', 'id' => 'confirm-button']);
?>
</div>
</div>
<?php
} else {
echo '</table>';
echo '<span class="col-md-12 text-center">Корзина пуста</span>';
}
示例14: switch
echo Html::input('hidden', 'update', $_POST['update']);
?>
<?php
switch ($_POST['update']) {
case 1:
echo Html::label('旧邮箱地址');
echo Html::input('text', 'oldMail', '', ['id' => 'old-name']);
echo Html::submitButton('提交', ['class' => 'btn btn-primary', 'name' => 'submit']);
break;
case 2:
echo Html::beginTag('div', ['class' => '']);
echo Html::label('我的邮箱地址');
echo Html::input('text', 'NewMail', '', ['id' => 'old-name']);
echo '</div><div>';
echo Html::label('验证码');
echo \yii\captcha\Captcha::widget(['name' => 'UpdateMainForm[verifyCode]', 'template' => '{input}{image}' . Html::tag('a', '换一张', ['id' => 'link-captcha-change']), 'options' => ['class' => 'form-control', 'style' => 'display: inline-block; width:40%;margin-right:10px;'], 'imageOptions' => ['id' => 'captcha-img', 'alt' => '验证码'], 'captchaAction' => '/support/captcha']);
echo Html::endTag('div');
echo Html::submitButton('提交', ['class' => 'btn btn-primary', 'name' => 'submit']);
break;
case 3:
echo Html::tag('p');
echo '已发送验证邮件:*****@gmail.com';
echo Html::endTag('p');
echo '验证邮件24小时内有效,请尽快登录您的邮箱';
echo Html::submitButton('查看验证邮件', ['class' => 'btn btn-danger', 'name' => 'submit']);
break;
}
?>
<?php
echo Html::endForm();
?>