PHP setlocale() ការប្រតិបត្តិ
ឧទាហរណ៍
កំណត់ពន្ធនាការតំបន់ទៅ US English បន្ទាប់មកកំណត់ត្រលប់ទៅជាការតំរងតាមប្រព័ន្ធ
<?php echo setlocale(LC_ALL,"US"); echo "<br>"; echo setlocale(LC_ALL,NULL); ?>
ការអង្គពិធី និងការប្រើប្រាស់
setlocale() ការប្រតិបត្តិ កំណត់ពន្ធនាការតំបន់ (ពន្ធនាការតំបន់)
ពន្ធនាការតំបន់ គឺជាអត្ថប្រយោជន៍ និងព័ត៌មានផ្សេងៗ របស់តំបន់ជាច្រើន
Comment:ការប្រតិបត្តិ setlocale() រួមមានតែការផ្លាស់ប្តូរពន្ធនាការតំបន់ សំរាប់ស្គ្រីបបច្ចុប្បន្ន
ប្រឡាំងអាចប្រើ setlocale(LC_ALL,NULL) ដើម្បីកំណត់ពន្ធនាការតំបន់ ទៅជាការតំរងតាមប្រព័ន្ធ
ប្រឡាំងសំរាប់ទទួលបានព័ត៌មានទំហំលេខ សូមមើល localeconv() ការប្រតិបត្តិ
ការប្រើប្រាស់
setlocale(constant,location)
អាត្រារម្មណ៍ | ការពន្យល់ |
---|---|
constant |
ចាំបាច់。 តម្លៃតាមដែលអាចប្រើ
|
location |
Required. Specifies which country/region to set the locale information to. It can be a string or an array. Multiple locations can be passed. If location The parameter is NULL or an empty string "", the location name will be set to the value of the environment variable with the same name as the constant above or set according to "LANG". If location The parameter is "0", the location setting is not affected, and only the current setting is returned. If location The parameter is an array, and setlocale() will try each array element until a valid language or locale code is found. This is very useful if a location has different names on different systems. Comment:To view all available language codes, please visit ourLanguage Code Reference Manual. |
Technical Details
Return Value: | Returns the current locale settings, or FALSE if failed. The return value depends on the system running PHP. |
PHP Version: | 4+ |
Update Log: |
In PHP 4.2.0, passing constants as strings is deprecated. Please use the available constants instead. Passing constants as strings will produce a warning message. In PHP 4.3.0, multiple locations can be passed. Since PHP 5.3.0, if passed to constant The parameter is a string, not one of the LC_ constants, and the function will throw an E_DREPRECATED notification. |