2

我将我的旧 xampp (1.7.3) localhost 服务器升级到 1.8.0 。现在,在我的所有页面中无法使用 smarty 模板引擎(2.6.6),我看到了Strict Standards错误。什么问题?如何解决这个问题?

NOTE : This Wroked Fine In Old 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)

function assign($var, $value) {
        global $Smarty;
        if (!isset($Smarty)) {
            STemplate::create(); // <---- line 42
        }
        $Smarty->assign($var, $value);
    }

谢谢你的帮助 :)

4

1 回答 1

3

这是因为您使用的是现代版本的 PHP 和strict standards. 您可以通过声明使代码工作:

public static function assign($var, $value)

但是,从其他错误来看,您会遇到很多问题。您可以尝试禁用严格的标准,但最好升级到现代版本的Smarty.

于 2012-07-30T12:09:46.947 回答