不推荐使用:不应静态调用非静态方法SmartyPaginate :: connect()

问题描述 投票:0回答:1

我正在为SMARTY模板使用SmartyPaginate插件,并从这个插件中抛出相同类型的6-7个错误。当我升级到PHP 7时,所有错误都出现了。虽然我可以禁用错误显示,但我真的想永久解决这个问题。

不推荐使用:非静态方法SmartyPaginate :: getCurrentIndex()不应在第58行的libs \ plugins \ function.paginate_prev.php中静态调用

抛出错误的代码。

if (SmartyPaginate::getCurrentIndex($_id) === false) {
    $smarty->trigger_error("paginate_prev: total was not set");
    return;        
}
smarty php-7 smarty3
1个回答
0
投票

我解决了所有的静态错误。我做了以下解决方案。旧代码

if (SmartyPaginate::getCurrentIndex($_id) === false) {
    $smarty->trigger_error("paginate_prev: total was not set");
    return;        
}

新规范

if ((new SmartyPaginate)->getCurrentIndex($_id) === false) {
    $smarty->trigger_error("paginate_next: total was not set");
    return;        
}
© www.soinside.com 2019 - 2024. All rights reserved.