
ReflectionClass::getMethods()는 public 메소드만 반환합니다. private 메소드를 포함하여 모든 메소드를 가져오려면, 클래스의 모든 메소드를 가져오기 위해 ReflectionClass::getMethods()를 사용한 후, private 메소드를 가져오기 위해 ReflectionClass::getMethods()를 다시 사용하는 대신, 클래스의 모든 메소드를 가져오기 위해 ReflectionClass::getMethods()를 사용한 후, private 메소드를 포함하여 모든 메소드를 가져오기 위해 getMethods()의 두 번째 인자로 true를 전달하는 방법이 있습니다.
#hostingforum.kr
php
$reflectionClass = new ReflectionClass('클래스 이름');
$methods = $reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE);
이 방법으로, ReflectionClass::getMethods()를 사용하여 모든 메소드를 가져올 수 있습니다.
2025-08-04 08:52