在Yii中不在对象上下文中时使用$ this

anu*_*anu 2 php yii yii-events yii-components yii-extensions

我在Fatal error: Using $this when not in object context in ..\controllers\ServiceRequestController.php on line 661使用EasyTabs扩展的控制器操作调用视图文件时遇到错误.
Iam在视图文件
ServiceRequestController::actionTest();
和控制器中调用这样的控制器动作

     public static function actionTest()  
   {
        $this->redirect('test');
    }
Run Code Online (Sandbox Code Playgroud)

我怎样才能摆脱这个错误?当我用Google搜索时,我发现了这一点$this cannot be used in a static method..所以我尝试
$model = new ServiceRequest(); $model->Test();在我的视图文件中使用.但它显示错误,ServiceRequest and its behaviors do not have a method or closure named "actionTest". 任何人都可以帮我修复错误?在此先感谢我尝试使用此链接修复.但我认为我错了.PHP致命错误:在不在对象上下文中时使用$ this

Mic*_*rtl 8

static定义操作时,请勿使用关键字.

您可以在此处阅读有关静态方法和属性的更多信息

http://de1.php.net/manual/en/language.oop5.static.php