2012-09-04 2 views
0

예를 들어 도움이된다면 클래스의 다른 정적 함수에서 정적 함수를 호출 할 수 있습니까?이 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. 
     } 

답변

4

대신 self::getconfig()을 사용해보세요.

+0

일,'자기 :: StaticMethod를();'과'자기 :: $ staticVar;'잘하지만, AFAIK, 작업'하는 theClass :: StaticMethod를(); ' 일해야한다. –

관련 문제