Internationalization ResourceBundle::get
ResourceBundle::get
resourcebundle_get
(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 2.0.0)
ResourceBundle::get -- resourcebundle_get — 번들에서 데이터 가져오기
설명
객체 지향 스타일
public ResourceBundle::get(string|int $index
, bool $fallback
= true
): mixed
절차 스타일:
resourcebundle_get(ResourceBundle $bundle
, string|int $index
, bool $fallback
= true
): mixed
인덱스 또는 문자열 키로 번들에서 데이터를 가져옵니다.
매개변수
bundle
- ResourceBundle 개체.
index
- 데이터 인덱스는 문자열 또는 정수여야 합니다.
fallback
- 로케일이 정확히 일치해야 하는지 또는 상위 로케일에 대한 대체가 허용되는지 여부.
반환 값
인덱스에 있는 데이터를 반환하거나 오류가 발생하면 null
을 반환합니다. 문자열, 정수 및 바이너리 데이터 문자열은 해당 PHP 유형으로 반환되고 정수 배열은 PHP 배열로 반환됩니다. 복합 유형은 ResourceBundle 객체로 반환됩니다.
Examples
예제 #1 resourcebundle_get() 예제
<?php
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
echo resourcebundle_get($r, 'somestring');
?>
예제 #2 OO 예제
<?php
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
echo $r->get('somestring');
?>
위의 예는 다음을 출력합니다.
?Hola, mundo!
기타
- resourcebundle_count() - 번들의 요소 수 가져오기