
ReflectionClass::getInterfaces 메소드는 클래스가 implements 한 인터페이스 목록을 반환합니다.
인터페이스가 implements 된 경우에도 반환됩니다.
예를 들어, 다음 코드의 경우 getInterfaces 메소드가 반환하는 인터페이스 목록에 AnimalInterface 이름이 포함됩니다.
#hostingforum.kr
php
class Animal implements AnimalInterface {
// ...
}
class AnimalInterface {
// ...
}
$reflectionClass = new ReflectionClass('Animal');
$interfaces = $reflectionClass->getInterfaces();
foreach ($interfaces as $interface) {
echo $interface->getName() . "n";
}
이 코드를 실행하면 AnimalInterface가 출력됩니다.
따라서, getInterfaces 메소드는 인터페이스가 implements 된 경우에도 반환하는 인터페이스 목록에 인터페이스 이름을 포함합니다.
2025-06-23 06:19