2016-01-28 13:30:28 3280次浏览 1条回答 0 悬赏 10 金钱

view页面代码

<div class="fb-ip-captcha-group">
<input type="text" placeholder="Security code"/> 
<?php $this->widget('CCaptcha',array('showRefreshButton'=>false,'clickableImage'=>true,'imageOptions'=>array('alt'=>'点击换图','title'=>'点击换图','style'=>'cursor:pointer'))); ?>
</div>

controller层代码

public function actions()
{ 
    return array( 
        // captcha action renders the CAPTCHA image displayed on the contact page
        'captcha'=>array(
            'class'=>'CCaptchaAction',
            'backColor'=>0xFFFFFF, 
            'maxLength'=>'5',       // 最多生成几个字符
            'minLength'=>'5',       // 最少生成几个字符
            'height'=>'45',
            'width'=>'130'
        ), 
    ); 
}
public function accessRules(){
    return array(
        array('allow',
            'actions'=>array('captcha'),
            'users'=>array('*'),
        ),
    );
}

GD扩展已经打开,但是验证码图片不显示,提示404 NOT Found
<img src="/captcha/v/56a9a2e064417" id="yw0" style="cursor:pointer" title="点击换图" alt="点击换图">

  • 回答于 2016-01-28 16:07 举报

    图片路径可对?

    1 条回复
    回复于 2016-01-29 10:56 回复

    验证码图片不对的,需要加上当前的action才对的

您需要登录后才可以回答。登录 | 立即注册
zl6592787
试用期

zl6592787

注册时间:2016-01-28
最后登录:2019-09-25
在线时长:2小时50分
  • 粉丝1
  • 金钱15
  • 威望0
  • 积分35

热门问题