You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

修复PHP Deprecated错误:非静态方法Rules::getStickerData()被静态调用

解决PHP Deprecated错误:静态调用非静态方法问题

修改步骤

  • 定位到public_html/modules/productlabelsandstickers/productlabelsandstickers.php文件的777行和901行,原出错代码为:

    $excluded_p = Rules::getStickerData($value['fmm_stickers_rules_id']);
    
  • 将代码替换为非静态调用方式:

    1. 先实例化Rules类(若类的构造函数无需参数,直接使用以下代码):
      $rulesInstance = new Rules();
      
    2. 通过实例调用方法:
      $excluded_p = $rulesInstance->getStickerData($value['fmm_stickers_rules_id']);
      

特殊情况说明

如果Rules类的构造函数需要传入参数(比如数据库连接对象、配置参数等),请根据类的实际定义传入对应参数。例如构造函数为public function __construct($db),则实例化代码改为:

$rulesInstance = new Rules($db); // $db为项目中实际的数据库连接实例

修改完成后,静态调用非静态方法触发的PHP Deprecated错误会消失,可有效减缓日志文件的增长速度。

内容的提问来源于stack exchange,提问作者Darcy Martin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 08:49:50