Yii1.1中Controller中的accessControl与验证码冲突

时间:2018-10-15 08:49:16

标签: php yii captcha

首先,当我在控制器中使用accessControl过滤器时,登录页面中的验证码未显示,这就是我在控制器中的代码

public function actions()
    {
        return array(
                // captcha action renders the CAPTCHA image displayed on the contact page
                'captcha'=>array(
                        'class'=>'CCaptchaAction',
                        'backColor'=>0xF8F8F8,
                        'foreColor'=>0x000000,
                ),
                // page action renders "static" pages stored under 'protected/views/site/pages'
                // They can be accessed via: index.php?r=site/page&view=FileName
                'page'=>array(
                        'class'=>'CViewAction',
                ),
        );
    }
    public function filters()
    {
        return array(
            'accessControl', // perform access control for CRUD operations
            //  'postOnly + delete', // we only allow deletion via POST request

        );

    }
    public function accessRules()
        {
            return array(
                    array('allow',  // allow all users to perform 'index' and 'view' actions
                            'actions'=>array('actions'),
                            'users'=>array('*'),
                    ),
array('allow',  // allow all users to perform 'index' and 'view' actions
                        'actions'=>array('index','captcha',),
    'users'=>array('*'),
)
)

              }

这是我的代码视图

$this->widget('CCaptcha', array( 'showRefreshButton'=>true,'buttonOptions'=>array('id'=>'refreshCaptcha','title'=>'Get a new code') ));

对我来说,登录屏幕在视图index.php中 我粘贴的captcha来自index.php 仍然没有任何效果 我在哪里弄错了。请向我建议正确的方法,以解决与accessControl冲突的验证码问题。预先感谢

0 个答案:

没有答案