English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
get_class_methods() 함수는 클래스의 메서드 이름으로 구성된 배열을 반환합니다
get_class_methods(\$class_name);
클래스 메서드 이름을 가져옵니다. class_name로 지정된 클래스에서 정의된 메서드 이름으로 구성된 배열을 반환합니다. 오류가 발생하면 NULL을 반환합니다.
순번 | 파라미터 및 설명 |
---|---|
1 | class_name(必需) 클래스 이름 |
class_name로 지정된 클래스에서 정의된 메서드 이름으로 구성된 배열을 반환합니다. 오류가 발생하면 NULL을 반환합니다.
이 함수의 사용법은 다음과 같습니다. HelloWorld 클래스의 메서드 이름을 가져옵니다-
<?php class HelloWorld { function HelloWorld() { return(true); } function myfunc1() { return(true); } function myfunc2() { return(true); } } \$method = get_class_methods('HelloWorld'); \$method = get_class_methods(new HelloWorld()); foreach (\$method as \$method_name) { echo "\$method_name \n"; } ?>테스트를 보세요 ‹/›
다음과 같은 결과를 생성합니다-
HelloWorld myfunc1 myfunc2