
1. ReflectionClass와 ReflectionMethod는 PHP에서 클래스와 메서드에 대한 정보를 추출하는 데 사용되는 클래스입니다.
ReflectionClass는 클래스에 대한 정보를 추출하는 데 사용되며, ReflectionMethod는 메서드에 대한 정보를 추출하는 데 사용됩니다.
2. ReflectionClass의 getMethods() 메서드는 클래스에 정의된 모든 메서드에 대한 ReflectionMethod 객체를 반환합니다.
3. ReflectionMethod::__toString() 메서드는 메서드의 이름을 문자열로 반환합니다.
4. 예시 코드입니다.
#hostingforum.kr
php
$reflectionClass = new ReflectionClass('MyClass');
$methods = $reflectionClass->getMethods();
foreach ($methods as $method) {
echo $method->__toString() . "n";
}
5. ReflectionMethod::__toString() 메서드는 메서드의 이름을 문자열로 반환합니다.
사용법은 위의 예시 코드와 같습니다.
2025-05-04 02:33