
	                	                 
SoapServer::addFunction을 사용하여 등록된 함수를 가져와서 호출하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$server = new SoapServer(null, array('uri' => 'http://example.com/soap'));
$server->addFunction('getHello');
// 다른 파일에서 호출하는 방법
$client = new SoapClient('http://example.com/soap?wsdl');
$result = $client->getHello();
print($result);
또한, addFunction을 사용하여 등록된 함수를 가져와서 호출하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$server = new SoapServer(null, array('uri' => 'http://example.com/soap'));
$server->addFunction('getHello');
// 등록된 함수 가져오기
$reflection = new ReflectionClass('SoapServer');
$methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
foreach ($methods as $method) {
    if ($method->getName() == 'getHello') {
        $func = $method->getClosure($server);
        $result = $func();
        print($result);
    }
}
이러한 방법을 사용하면 SoapServer::addFunction을 사용하여 등록된 함수를 다른 파일에서 호출할 수 있습니다.
2025-06-30 12:34