Fatal error: Using $this when not in object context in ..\controllers\ServiceRequestController.php on line 661
EasyTabs 拡張機能からコントローラー アクションを使用してビュー ファイルを呼び出すときのようなエラーが発生します。
ビューファイル
ServiceRequestController::actionTest();
とコントローラーで、このようにコントローラーアクションを呼び出しています
public static function actionTest()
{
$this->redirect('test');
}
どうすればこのエラーを取り除くことができますか?? グーグルで検索したところ、それが見つかりました$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 を使用する