setlocale()函数

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) 

提示:可以使用setlocale(LC_ALL,NULL)函数将场景信息设置为系统默认值。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值