get_class_methods() 함수는 클래스 메서드의 이름을 가져옵니다. name_of_class에 의해 지정된 클래스에 대해 정의된 메서드 이름의 배열을 반환합니다. 오류가 발생하면 NULL을 반환합니다.
구문
get_class_methods(class)
매개변수
-
name_of_class - 클래스 이름. 필수!
반환
get_class_methods() 함수는 name_of_class에 의해 지정된 클래스에 대해 정의된 메서드 이름의 배열을 반환합니다. 오류가 발생하면 NULL을 반환합니다.
예시
다음은 예입니다 -
<?php
class Demo {
function Demo() {
return(true);
}
function displayOne() {
return(true);
}
function displayTwo() {
return(true);
}
}
$method = get_class_methods('Demo');
$method = get_class_methods(new Demo());
foreach ($method as $method_name) {
echo "$method_name \n";
}
?> 출력
Demo displayOne displayTwo