严格标准:非静态方法 STemplate::assign() 不应静态调用 [英] Strict Standards: Non-static method STemplate::assign() should not be called statically
问题描述
我将旧的 xampp (1.7.3) 本地主机服务器升级到 1.8.0 .现在,不能在我的所有页面中使用 smarty 模板引擎 (2.6.6),我看到 Strict Standards
错误.什么问题?如何解决这个问题?
i Upgrade my old xampp (1.7.3) localhost server to 1.8.0 . now, not work smarty template engine (2.6.6) in my all page and i see Strict Standards
error. what's problem? how to fix this ?
注意:这在旧 Xampp(1.7.3) 中运行良好.
错误部分:
Strict Standards: Non-static method STemplate::assign() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 88
Strict Standards: Non-static method STemplate::create() should not be called statically in C:\xampp\htdocs\tube\libraries\mysmarty.class.php on line 42
Strict Standards: Non-static method STemplate::setCompileDir() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 181
Strict Standards: Non-static method STemplate::setTplDir() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 182
我的配置行错误:
STemplate::assign($field, $config[$field]); // line 88
STemplate::setCompileDir($config['basedir']."/temporary"); // line 181
STemplate::setTplDir($config['basedir']."/themes"); // line 182
my.Smarty.class.php(错误行 2)
my.Smarty.class.php (error line 2)
function assign($var, $value) {
global $Smarty;
if (!isset($Smarty)) {
STemplate::create(); // <---- line 42
}
$Smarty->assign($var, $value);
}
感谢您的帮助:)
推荐答案
这是因为您使用的是具有严格标准
的现代版本的 PHP.您可以通过声明来使代码工作:
It's because you're using a modern version of PHP with strict standards
. You may be able to make the code work by making the declaration:
public static function assign($var, $value)
但是,从其他错误来看,您会遇到很多问题.您可以尝试禁用严格的标准,但最好升级到现代版本的 Smarty
.
However judging by the other errors you'll run into many problems. You can try disabling strict standards but it'd be best to upgrade to a modern version of Smarty
.
这篇关于严格标准:非静态方法 STemplate::assign() 不应静态调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!