Internationalization IntlCalendar::getErrorCode
IntlCalendar::getErrorCode
intlcal_get_error_code
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getErrorCode -- intlcal_get_error_code — 개체에 대한 마지막 오류 코드 가져오기
설명
객체 지향 스타일 (method):
public IntlCalendar::getErrorCode(): int|false
절차적 스타일
intlcal_get_error_code(IntlCalendar $calendar
): int|false
이 개체에 대한 마지막 호출(복제 포함)에 대한 숫자 ICU 오류 코드 또는 calendar
매개변수에 대해 제공된 IntlCalendar(절차 스타일 버전)를 반환합니다. 이것은 경고(음수 오류 코드)만 표시하거나 오류가 전혀 표시되지 않음(U_ZERO_ERROR
)을 나타낼 수 있습니다. 오류의 실제 존재는 intl_is_failure()를 사용하여 테스트할 수 있습니다.
PHP 측(ICU 라이브러리의 함수를 호출하기 전)에서 감지된 유효하지 않은 인수는 이 함수를 위해 기록되지 않습니다.
초기 인수 오류를 포함하여 intl 확장의 함수에 대한 모든 호출에서 발생한 마지막 오류는 intl_get_error_code()를 사용하여 얻을 수 있습니다. 이 함수는 전역 오류 코드를 재설정하지만 개체의 오류 코드는 재설정하지 않습니다.
매개변수
calendar
- 절차 스타일 인터페이스의 달력 개체입니다.
반환 값
성공, 실패 또는 경고를 나타내는 ICU 오류 코드. 실패 시 false
를 반환합니다.
Examples
예제 #1 IntlCalendar::getErrorCode() 및 IntlCalendar::getErrorMessage()
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = new IntlGregorianCalendar(2012, 1, 29);
var_dump(
$intlcal->getErrorCode(),
$intlcal->getErrorMessage()
);
$intlcal->fieldDifference(-1e100, IntlCalendar::FIELD_SECOND);
var_dump(
$intlcal->getErrorCode(),
$intlcal->getErrorMessage()
);
위의 예는 다음을 출력합니다.
int(0) string(12) "U_ZERO_ERROR" Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in /home/glopes/php/ws/example.php on line 10 int(1) string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
기타
- IntlCalendar::getErrorMessage() - 상위 디렉토리의 경로를 반환
- intl_is_failure() - 주어진 오류 코드가 실패를 나타내는지 확인
- intl_error_name() - 주어진 오류 코드에 대한 기호 이름 가져오기
- intl_get_error_code() - 마지막 오류 코드 가져오기
- intl_get_error_message() - 마지막 오류에 대한 설명 가져오기