将区域设置设置为美国英语,然后再次恢复为默认值:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
亲自试一试 »
setlocale() 函数设置区域设置信息。
区域设置信息是特定于地理区域的语言、货币、时间和其他信息。
笔记:setlocale() 函数仅更改当前脚本的区域设置。
提示:可以使用 setlocale(LC_ALL,NULL) 将语言环境信息设置为系统默认值
提示:要获取数字格式信息,请参阅语言环境转换()功能。
setlocale(
constant,location)
Parameter | Description |
---|---|
constant | Required. Specifies what locale information should be set. Available constants:
|
location | Required. Specifies what country/region to set the locale information to. Can be a string or an array. It is possible to pass multiple locations. If the location is NULL or the empty string "", the location names will be set from the values of environment variables with the same names as the constants above, or from "LANG". If the location is "0", the location setting is not affected, only the current setting is returned. If the location is an array, setlocale() will try each array element until it finds a valid language or region code. This is very useful if a region is known under different names on different systems. Note: To view all available language codes, go to our Language code reference. |
返回值: | 返回当前区域设置,失败时返回 FALSE。返回值取决于 PHP 运行的系统。 |
---|---|
PHP 版本: | 4+ |
变更日志: | PHP 5.3.0 - 如果将字符串传递给持续的参数而不是 LC_ 常量之一,此函数会抛出 E_DREPRECATED 通知。 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!