setlocale()函数
Definition and Usage
定义和用法
The setlocale() function sets locale information.
setlocale()函数的作用是:设置场景信息。
Locale information is language, monetary, time and other information specific for a geographical area.
本地信息可以是指定的某个区域的语言、货币、时间以及其它的信息。
This function returns the current locale settings, or FALSE on failure.
如果这个函数成功执行,将返回当前的场景属性;如果执行失败,将返回False。
Syntax
语法
setlocale(constant,location)
Parameter参数 Description描述
constant Required. Specifies what locale information should be set.
必要参数。指定需要设置的场景信息
Available constants:
可用的常量:
LC_ALL - All of the below
LC_ALL – 所有下属的常量
LC_COLLATE - Sort order
LC_COLLATE – 排列顺序
LC_CTYPE - Character classification and conversion (e.g. all characters should be lower or upper-case)
LC_CTYPE – 字符分类和转换(例如:将所有的字符转换成小写或大写形式)
LC_MESSAGES - System message formatting
LC_MESSAGES – 系统信息格式
LC_MONETARY - Monetary/currency formatting
LC_MONETARY – 货币 / 通货格式
LC_NUMERIC - Numeric formatting
LC_NUMERIC – 数值格式
LC_TIME - Date and time formatting
LC_TIME – 日期和时间格式
location Required. Specifies what country/region to set the locale information to. Can be a string or an array. 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.
必要参数。指定需要进行场景信息设置的国家或区域。它可以由一个字符串或一个数组组成。如果本地区域是一个数组,那么setlocale()函数将尝试每 个数组元素直到它从中获取有效的语言和区域代码信息为止。如果一个区域处于不同操作系统中的不同名称下,那么这个参数将非常有用。
Note: Here you can find language and region codes.
注意:你可以通过下面一个地址查询:语言信息和区域代码
--------------------------------------------------------------------------------
Tips and Notes
提示和注意点
Note: The setlocale() function changes the locale only for the current script.
注意:setlocale()函数仅改变当前脚本程序中的场景。
Tip: The locale information can be set to system default with setlocale(LC_ALL,NULL)
Definition and Usage
定义和用法
The setlocale() function sets locale information.
setlocale()函数的作用是:设置场景信息。
Locale information is language, monetary, time and other information specific for a geographical area.
本地信息可以是指定的某个区域的语言、货币、时间以及其它的信息。
This function returns the current locale settings, or FALSE on failure.
如果这个函数成功执行,将返回当前的场景属性;如果执行失败,将返回False。
Syntax
语法
setlocale(constant,location)
Parameter参数 Description描述
constant Required. Specifies what locale information should be set.
必要参数。指定需要设置的场景信息
Available constants:
可用的常量:
LC_ALL - All of the below
LC_ALL – 所有下属的常量
LC_COLLATE - Sort order
LC_COLLATE – 排列顺序
LC_CTYPE - Character classification and conversion (e.g. all characters should be lower or upper-case)
LC_CTYPE – 字符分类和转换(例如:将所有的字符转换成小写或大写形式)
LC_MESSAGES - System message formatting
LC_MESSAGES – 系统信息格式
LC_MONETARY - Monetary/currency formatting
LC_MONETARY – 货币 / 通货格式
LC_NUMERIC - Numeric formatting
LC_NUMERIC – 数值格式
LC_TIME - Date and time formatting
LC_TIME – 日期和时间格式
location Required. Specifies what country/region to set the locale information to. Can be a string or an array. 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.
必要参数。指定需要进行场景信息设置的国家或区域。它可以由一个字符串或一个数组组成。如果本地区域是一个数组,那么setlocale()函数将尝试每 个数组元素直到它从中获取有效的语言和区域代码信息为止。如果一个区域处于不同操作系统中的不同名称下,那么这个参数将非常有用。
Note: Here you can find language and region codes.
注意:你可以通过下面一个地址查询:语言信息和区域代码
--------------------------------------------------------------------------------
Tips and Notes
提示和注意点
Note: The setlocale() function changes the locale only for the current script.
注意:setlocale()函数仅改变当前脚本程序中的场景。
Tip: The locale information can be set to system default with setlocale(LC_ALL,NULL)
提示:可以使用setlocale(LC_ALL,NULL)函数将场景信息设置为系统默认值。