CCaptcha displaying no image yii

后端 未结 2 1529
太阳男子
太阳男子 2020-12-20 19:50

I have a user registration form, in which I am trying to display a Captcha image by using Yii widget CCaptcha, however my image link appears broken, Controller file:

相关标签:
2条回答
  • 2020-12-20 20:30

    The problem was with the controller file,it should have been,

    public function accessRules()
        {
            return array(
                array('allow', 
                    'actions'=>array('create', 'captcha'),
                    'users'=>array('*'),
                ),
        } 
    


    whereas I had mentioned the action for captcha at the end, which I figured out is not allowed in Yii. All the allow actions for * should be together.

    0 讨论(0)
  • 2020-12-20 20:30

    Yii captcha will create a png image. A possible explanation for the broken image link would be a missing GD extension or imagick extension, which can be identified by the presence of the following text in your error.log:

    call to undefined function imagecreatetruecolor

    For details and fix see "call to undefined function imagecreatetruecolor" error in PHP & pChart

    0 讨论(0)
提交回复
热议问题