
ReflectionClass::getReflectionConstant 메소드는 클래스의 상수 이름을 인수로 받습니다. 하지만, 이 메소드는 클래스의 상수 이름이 아닌 상수 값을 반환하지 않습니다. 따라서, getReflectionConstant 메소드는 클래스의 상수 이름을 반환합니다.
올바른 방법으로 상수 값을 가져올 수 있는 방법은 ReflectionClass::getConstant 메소드를 사용하는 것입니다.
#hostingforum.kr
php
$reflectionClass = new ReflectionClass('MyClass');
$constantValue = $reflectionClass->getConstant('MY_CONSTANT');
이 방법은 클래스의 상수 이름을 인수로 받고, 상수 값을 반환합니다.
2025-07-30 17:58