严格的标准保持这个错误

时间:2013-08-06 14:55:14

标签: templates

我不断收到此浏览器错误

Strict Standards: Non-static method JSite::getMenu() should not be called statically, 
assuming $this from incompatible context 
in C:\xampp\htdocs\afvidz\templates\videoplus\index.php on line 53`

Strict Standards: Non-static method JApplication::getMenu() should not be called statically, 
assuming $this from incompatible context 
in C:\xampp\htdocs\afvidz\includes\application.php on line 593`

这是我的第53行

$menu = JSite::getMenu();

和第593行

$menu = parent::getMenu('site', $options);

2 个答案:

答案 0 :(得分:1)

你试着以静态方式调用object方法(类方法)

$object - new JSite;
$menu = $object->getMenu();

答案 1 :(得分:1)

如果它是静态方法,则无法调用getMenu

你应该这样做:

$object = new JSite;             // First you create an object
$menu = $object->getMenu();      // Finally you call getMenu

查看文档以了解什么是static方法:http://www.php.net/manual/en/language.oop5.static.php

此链接在您的情况下也非常有用:http://www.php.net/manual/en/language.oop5.basic.php(结帐第二个示例)。