Reflection ReflectionClass::export
(PHP 5, PHP 7)
ReflectionClass::export — 클래스 내보내기
경고 이 함수는 PHP 7.4.0부터 DEPRECATED되었으며 PHP 8.0.0부터 제거되었습니다. 이 함수에 의존하는 것은 매우 권장되지 않습니다.
설명
public static ReflectionClass::export(mixed $argument
, bool $return
= false
): string
반영된 클래스를 내보냅니다.
매개변수
argument
- 내보낼 reflection입니다.
return
true
로 설정하면 방출이 아닌 내보내기가 반환됩니다.false
(기본값)로 설정하면 반대가 됩니다.
반환 값
반환 매개변수가 true
로 설정되면 내보내기가 문자열로 반환되고, 그렇지 않으면 null
이 반환됩니다.
Examples
예제 #1 ReflectionClass::export()의 기본 사용법
<?php
class Apple {
public $var1;
public $var2 = 'Orange';
public function type() {
return 'Apple';
}
}
ReflectionClass::export('Apple');
?>
위의 예는 다음과 유사한 결과를 출력합니다.
Class [ <user> class Apple ] { @@ php shell code 1-8 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [2] { Property [ <default> public $var1 ] Property [ <default> public $var2 ] } - Methods [1] { Method [ <user> public method type ] { @@ php shell code 5 - 7 } } }
기타
- ReflectionClass::getName() - 클래스 이름 가져오기
- ReflectionClass::__toString() - ReflectionClass 객체의 문자열 표현을 반환합니다.