验证码输入的是正确的,但是提示验证码错误 [ 2.0 版本 ]
验证码输入的是正确的,但是提示验证码错误
控制器
public function actions() {
// return external action classes, e.g.:
return array(
'captcha' => array(
'class' => 'CCaptchaAction',
'backColor' => 0xF1F1F1,
'fixedVerifyCode' => substr(md5(time()),11,4), //每次都刷新验证码
),
);
}
代码
<?php if (CCaptcha::checkRequirements()): ?>
<tr>
<td height="25" colspan="2">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="70" height="25" align="right">验证码:</td>
<td width="75" height="25"><input data-validate="required:验证码不为空" class="in_yz" placeholder=" 验证码" maxlength="4" name="LoginFormMem[verifyCode]" id="LoginFormMem_verifyCode" type="text" /></td>
<td width="78" height="25" align="center"><?php $this->widget('CCaptcha', array('showRefreshButton' => false, 'clickableImage' => true, 'imageOptions' => array('alt' => '点击换图', 'title' => '点击换图', 'style' => 'cursor:pointer;width:70px;'))); //, array('class'=>'captcha') ?></td>
</tr>
</tbody>
</table>
</td>
</tr>
<?php endif; ?>
测试地址:首页的登录老是提示验证码错误,然后跳转到会员登录页面在重新输入验证码又正常登录了
http://www.rbzygs.com/
共 2 个回答
-
检查你首页提交的验证码数据是否异常
共 3 条回复q573927428 回复于 2015-11-09 09:53 回复你好,可以告诉下我们怎么解决这个问题吗
@q573927428 都还不知道你的问题,如何解决
q573927428 回复于 2015-11-09 12:25 回复@koko 就是首页登录的时候 正确的输入验证码,但是提示验证码错误
-
共 4 条回复q573927428 回复于 2015-11-09 12:25 回复
继承并重写一下 yii\captcha\CaptchaAction 类里面的 生成验证码的策略吧.
这个需要怎么重新 可以帮我写一下吗@q573927428 你把
'fixedVerifyCode' => substr(md5(time()),11,4),
去掉好了, 不用重写, 你这个地方没有重写的必要q573927428 回复于 2015-11-10 18:14 回复@500miles 好的 ,但是这句删掉了还是无法解决问题。网站首页正确输入验证码,还提示验证码错误
@q573927428 那这样我可能就帮不上什么忙了. 只能说 : 验证码是存在session了, 具体原理你也知道,.. 就围绕这个 多调试吧 没其他办法
q573927428
注册时间:2015-11-08
最后登录:2016-03-01
在线时长:0小时56分
最后登录:2016-03-01
在线时长:0小时56分
- 粉丝1
- 金钱0
- 威望0
- 积分0