Internationalization IntlDateFormatter::getErrorCode
IntlDateFormatter::getErrorCode
datefmt_get_error_code
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::getErrorCode -- datefmt_get_error_code — 마지막 작업에서 오류 코드 가져오기
설명
객체 지향 스타일
public IntlDateFormatter::getErrorCode(): int
절차 스타일:
datefmt_get_error_code(IntlDateFormatter $formatter
): int
마지막 작업에서 오류 코드를 가져옵니다. 마지막 숫자 형식 지정 작업에서 오류 코드를 반환합니다.
매개변수
formatter
- 포맷터 리소스.
반환 값
UErrorCode 값 중 하나인 오류 코드입니다. 초기값은 U_ZERO_ERROR입니다.
Examples
예제 #1 datefmt_get_error_code() 예제
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
$str = datefmt_format($fmt);
if (!$str) {
printf(
"ERROR: %s (%d)\n",
datefmt_get_error_message($fmt),
datefmt_get_error_code($fmt)
);
}
?>
예제 #2 OO 예제
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
$str = $fmt->format();
if (!$str) {
printf(
"ERROR: %s (%d)\n",
$fmt->getErrorMessage(),
$fmt->getErrorCode()
);
}
?>
위의 예는 다음을 출력합니다.
ERROR: U_ZERO_ERROR (0)
기타
- datefmt_get_error_message() - 마지막 작업에서 오류 텍스트 가져오기
- intl_get_error_code() - 마지막 오류 코드 가져오기
- intl_is_failure() - 주어진 오류 코드가 실패를 나타내는지 확인