我用xampp运行项目时没有错误,但在线时出现这些错误
问题描述:
我是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 '],
]
]);
?>
答
只是使用的
Yii::$app->controller->actionCategories($row['id']);
代替
\frontend\controllers\SiteController::actionCategories($row['id']);
+0
非常感谢它的作品, –
+0
请问您可以投票吗?我是问题禁令:-( –
似乎还有在路径或路由问题。请检查一次。请分享您的错误信息 – Deep
不存在没有问题的路径和路由 –
在你的小鸟是否有可能是因为PHP版本 –