0

我不断收到此浏览器错误

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);
4

2 回答 2

1

Yoiu 尝试以静态方式调用对象方法(类方法)

$object - new JSite;
$menu = $object->getMenu();
于 2013-08-06T15:00:28.300 回答
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(查看第二个示例)。

于 2013-08-06T15:03:08.690 回答