chenkelang90120 2012-08-11 11:36:15 3679次浏览 5条回复 0 0 0

如标题所说我要在刷新页面的时候让验证吗也刷新怎么办?

视图中的代码

<?php $this->widget('CCaptcha',array('showRefreshButton'=>true,'clickableImage'=>true,'imageOptions'=>array('alt'=>'点击换图','title'=>'点击换图','style'=>'cursor:pointer;margin-bottom:-12px;'),'buttonLabel'=>'看不清楚?')); ?>

控制器中的代码

'captcha'=>array(
    'class'=>'CCaptchaAction',
    'backColor'=>0x3DE337,
    'minLength'=>4,
    'maxLength'=>4,
    'height'=>30,
    'width'=>55,
),

模型 array('verifycode', 'captcha'),

  • 回复于 2012-08-11 18:57 举报

    model里,这样试试。array('verifyCode', 'captcha', 'on'=>'login', 'allowEmpty'=> !extension_loaded('gd'))

  • 回复于 2012-08-14 07:57 举报

    找到文件:yii\framework\validators\CCaptchaValidator.php
    修改:
    方法 public function clientValidateAttribute($object,$attribute)
    中的(该文件第97行把false改为true)$code=$captcha->getVerifyCode(false);修改为 $code=$captcha->getVerifyCode(true);

  • 回复于 2012-08-14 10:34 举报

    试了2楼的代码没有用,3楼中的方法也不行啊!

  • 回复于 2012-11-01 10:02 举报

    楼主解决没有啊?强烈想知道怎么弄的呀

  • 回复于 2012-11-01 11:16 举报

    没有呢!就这样先用着

您需要登录后才可以回复。登录 | 立即注册