問(wèn)題描述
為什么 setlocale(LC_ALL, 'en_GB.UTF8');
在 Windows Server 2003 R2 - Zend CE PHP 5.3.5 上返回 false ?
Why does setlocale(LC_ALL, 'en_GB.UTF8');
return false on Windows Server 2003 R2 - Zend CE PHP 5.3.5 ?
有問(wèn)題的函數(shù):setlocale
.
Function in question: setlocale
.
推薦答案
來(lái)自 PHP 手冊(cè):
setlocale()
的返回值取決于 PHP 運(yùn)行的系統(tǒng).它準(zhǔn)確返回系統(tǒng) setlocale 函數(shù)返回的內(nèi)容.
The return value of
setlocale()
depends on the system that PHP is running. It returns exactly what the system setlocale function returns.
因此,在您的情況下,它返回 false,因?yàn)橄到y(tǒng)返回 false.您使用的區(qū)域設(shè)置可能在您的系統(tǒng)上不可用.
So in your case it returns false because the system returns false. It is likely that the locale you're using is not available on your system.
Windows 支持的 setlocale
字符串列表可用 此處.對(duì)于英式英語(yǔ),您需要 eng??code>、
english-uk
或 uk
.不過(guò),Windows 不支持像 UTF-8 這樣的多字節(jié)字符集;您可能最終會(huì)使用 Windows-1252.
A list of setlocale
strings supported by Windows is available here. For British English you want eng
, english-uk
, or uk
. Windows doesn't support multi-byte character sets like UTF-8 though; you will probably end up with Windows-1252.
這篇關(guān)于setlocale(LC_ALL, 'en_GB.UTF8') 不適用于 Windows的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!