我在 Yii 中有应用程序,我从一些基本控制器扩展了所有类,并且我有这些代码:
protected function beforeAction($action)
{
$this->setglobalvariable();
return parent::beforeAction($action);
}
据我所知,这些代码会阻止验证码显示,因为当我删除它时,验证码会显示出来!验证码功能是:
public function actions()
{
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xFFFFFF,
'minLength'=>2,
'maxLength'=>3,
'width'=>60,
),
// 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',
),
);
}
那么我如何同时使用 beforeAction 和 captcha 呢?