Locale::setDefault()
locale_set_default
(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Sets the default runtime locale
说明
面向对象风格public static Locale::setDefault(string $locale): bool
过程化风格
locale_set_default(string $locale): bool
Sets the default runtime locale to $locale. This changes the value of INTL global 'default_locale' locale identifier. UAX #35 extensions are accepted.
参数
- $locale
Is a BCP 47 compliant language tag.
返回值
成功时返回TRUE
,或者在失败时返回FALSE
。
范例
locale_set_default() example
<?php locale_set_default('de-DE'); echo locale_get_default(); ?>
OO example
<?php Locale::setDefault('de-DE'); echo Locale::getDefault(); ?>
以上例程会输出:
de-DE
参见
- locale_get_default() Gets the default locale value from the INTL global 'default_locale'