【发布时间】:2020-01-15 01:36:50
【问题描述】:
我在其中一种形式中使用了验证码。总是报验证码不正确的错误。
下面是我的代码:
SchoolsController.php
public function actions() {
return [
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fontFile' => '@yii/captcha/SpicyRice.ttf',
'padding' => '0',
]
];
}
型号:
['verifyCode', 'captcha', 'captchaAction' => 'schools/captcha'],
查看:
echo $form->field($modelSchoolRequestEarlyAccess, 'verifyCode')->widget(Captcha::className(), [
'options' => [
'placeholder' => 'Enter characters in the image',
'autocomplete' => 'off',
'maxlength' => 20
],
'captchaAction' => 'schools/captcha',
'template' => "<div class='field'><span><strong>*</strong>".Yii::t('frontend/quicksignup','VerifyCodeLabel').":</span></span>\n<div>{image}{input}<i class='refresh-code-icn' id='get-new-code'></i></div></div>"
])->label(false);
我在模型和视图中将验证码操作指定为schools/captcha。但总是显示验证不正确。
我做错了什么??
【问题讨论】: