2016-03-09 17 views
0

我是Yii2的初學者,當我通過Xampp運行我的網站時,我沒有任何錯誤,但是在我將它上載到Linux服務器後,我得到這個錯誤:我用xampp運行項目時沒有錯誤,但在線時出現這些錯誤

Non-static method frontend\controllers\SiteController::actionCategories() should not be called statically, assuming $this from incompatible context

這是什麼原因造成的?

<?php 
     $category_post = \frontend\controllers\SiteController::actionCategories($row['id']); 
     echo ListView::widget([ 
      'dataProvider' => $category_post, 
      'itemView' => 'news_title', 
      'summary' => '', 
      'pager' => [ 
       'options' => ['class' => 'row pagination '], 
      ] 
     ]); 
?> 
+0

似乎還有在路徑或路由問題。請檢查一次。請分享您的錯誤信息 – Deep

+0

不存在沒有問題的路徑和路由 –

+0

在你的小鳥是否有可能是因爲PHP版本 –

回答

1

只是使用的

Yii::$app->controller->actionCategories($row['id']); 

代替

\frontend\controllers\SiteController::actionCategories($row['id']); 
+0

非常感謝它的作品, –

+0

請問您可以投票嗎?我是問題禁令:-( –

相關問題