59

最近、PHP 5.4 に更新しましたが、静的コードと非静的コードに関するエラーが表示されます。

これはエラーです:

PHP Strict Standards:  Non-static method VTimer::get() 
should not be called statically in /home/jaco/public_html/include/function_smarty.php on line 371

これは 371 行目です。

$timer  = VTimer::get($options['magic']);

誰かが助けてくれることを願っています。

4

4 に答える 4

18

次のようにメソッドを静的に変更することもできます。

class Handler {
    public static function helloWorld() {
        echo "Hello world!";
    }
}
于 2016-06-21T04:42:05.207 に答える