我们可以在类中的其他静态函数中调用一个静态函数吗


can we call a static function in other static function in a class

我们可以在类中的其他静态函数中调用静态函数吗?如果可以,请帮助我。我正在使用这段php代码。

static function getconfig()
{
$db = JFactory::getDBO();
$query='select * from #__yellowpages_config';
$db->setQuery($query);
$result=$db->loadObject();

$config->city=JRequest::getVar('city',0);
$config->country=JRequest::getVar('c',0);
if($config->city==0)
$config->city=$result->city;
if($config->country==0)
$config->country=$result->country;
return $config;
}
static function getitem()
       {
        //how I call the getconfig function here.
       }

请尝试使用self::getconfig()

如果要引用同一个类,请使用self::method()

如果要引用层次结构中调用方法的任何类,请使用static::method()

另请参阅此问题:新的自我与新的静态