3

有没有一种简单的方法可以从 中检索语言环境timezone_identifier

例如:

date_default_timezone_set('Europe/Berlin');

在这种情况下,语言环境应该de_DE

4

2 回答 2

2

如前所述deceze,这是不可能的。但是您可以从时区获取位置信息。正如php.net所说

$tz = new DateTimeZone("Europe/Prague"); 
print_r($tz->getLocation());
print_r(timezone_location_get($tz));

将输出

Array
(
 [country_code] => CZ
 [latitude] => 50.08333
 [longitude] => 14.43333
 [comments] => 
)
Array
(
 [country_code] => CZ
 [latitude] => 50.08333
 [longitude] => 14.43333
 [comments] => 
)
于 2012-11-02T09:24:29.750 回答
1

不,因为不存在这样的 1:1 相关性。以比利时为例,他们在同一时区正式使用三种语言。

于 2012-11-02T09:18:27.170 回答