gpt4 book ai didi

php 5.3.2-1 代码不适用于 php 5.3.8

转载 作者:行者123 更新时间:2023-12-02 07:42:28 25 4
gpt4 key购买 nike

我的代码在 ubuntu 上的 php 5.3.2-1 中运行良好。我最近将它移植到安装了 XAMPP 的 Windows 上。它使用 php 5.3.8 。我收到错误消息。

 Non-static method Following::getUpdates() should not be called statically, assuming $this from incompatible context

有什么路要走?我是否应该更正我的代码以替换代码中每个位置的声明或者
有没有办法模拟旧的行为(带有 php.ini 文件的 php 5.3.2),因为我不确定在更正后我的脸上会抛出多少错误。

更新(代码示例)

public function actionIndex(){
if(yii::app()->user->isGuest){
$this->render('guestIndex');
}
else{
$dataProvider = Following::getUpdates(yii::app()->user->id); //genrerate data for the homepage of user i.e updates from followers
$this->render('userIndex',array('dataProvider'=>$dataProvider));
}


}

$dataProvider = Following::getUpdates(yii::app()->user->id); 行获取错误我正在使用 yii 框架。

最佳答案

您的新安装可能只包含 E_STRICT 警告,而您之前的安装没有。 Quoting the manual :

Calling non-static methods statically generates an E_STRICT level warning.

这意味着您可以通过在 error reporting 中禁用 E_STRICT 来消除警告,但在我看来,您应该修复有问题的代码。

关于php 5.3.2-1 代码不适用于 php 5.3.8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9684140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com