라이브러리
[PHP] ReflectionExtension::isPersistent - 이 확장이 지속되는지 여부를 반환합니다.
ReflectionExtension::isPersistent
PHP ReflectionExtension 클래스의 `isPersistent` 메소드는 PHP 확장 모듈이 영구적으로 로드되었는지 여부를 확인합니다.
# 사용법
`isPersistent` 메소드는 `ReflectionExtension` 객체를 인수로 받습니다. 이 메소드는 `true` 또는 `false`를 반환합니다.
# 예제
#hostingforum.kr
php
// PHP 확장 모듈을 로드합니다.
extension_loaded('curl');
// ReflectionExtension 객체를 생성합니다.
$reflectionExtension = new ReflectionExtension('curl');
// isPersistent 메소드를 호출합니다.
$isPersistent = $reflectionExtension->isPersistent();
// 결과를 출력합니다.
echo "PHP 확장 모듈 'curl'이 영구적으로 로드되었는지 여부: $isPersistent
";
# 결과
PHP 확장 모듈 'curl'이 영구적으로 로드되었는지 여부: 1 (true)
# 설명
위 예제에서 `extension_loaded` 함수를 사용하여 'curl' 확장 모듈이 로드되었는지 확인합니다. 그런 다음 `ReflectionExtension` 객체를 생성하고 `isPersistent` 메소드를 호출하여 확장 모듈이 영구적으로 로드되었는지 여부를 확인합니다.
# 참고
`isPersistent` 메소드는 PHP 7.2 이상에서 사용할 수 있습니다. PHP 7.1 이하에서는 사용할 수 없습니다.
# 추가 예제
#hostingforum.kr
php
// PHP 확장 모듈을 로드하지 않은 경우
$reflectionExtension = new ReflectionExtension('non_existent_extension');
$isPersistent = $reflectionExtension->isPersistent();
echo "PHP 확장 모듈 'non_existent_extension'이 영구적으로 로드되었는지 여부: $isPersistent
";
# 결과
PHP 확장 모듈 'non_existent_extension'이 영구적으로 로드되었는지 여부: (empty string)
# 설명
위 예제에서 'non_existent_extension' 확장 모듈이 로드되지 않았습니다. 따라서 `isPersistent` 메소드는 빈 문자열을 반환합니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.