2024 年日本 PHP 研討會

ResourceBundle::getErrorCode

resourcebundle_get_error_code

(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 2.0.0)

ResourceBundle::getErrorCode -- resourcebundle_get_error_code取得套件的最後一個錯誤碼

說明

物件導向風格

public ResourceBundle::getErrorCode(): int

程序式風格

resourcebundle_get_error_code(ResourceBundle $bundle): int

取得由 bundle 物件執行的最後一個函式的錯誤碼。

參數

bundle

ResourceBundle 物件。

回傳值

返回最後一次 bundle 物件呼叫的錯誤碼。

範例

範例 #1 resourcebundle_get_error_code() 範例

<?php
$r
= resourcebundle_create( 'es', "/usr/share/data/myapp");
echo
$r['somestring'];
if(
intl_is_failure(resourcebundle_get_error_code($r))) {
report_error("Bundle 錯誤");
}
?>

範例 #2 物件導向範例

<?php
$r
= new ResourceBundle( 'es', "/usr/share/data/myapp");
echo
$r['somestring'];
if(
intl_is_failure(ResourceBundle::getErrorCode($r))) {
report_error("Bundle 錯誤");
}
?>

參見

新增註解

使用者貢獻的註解

此頁面沒有使用者貢獻的註解。
To Top