1
<?php
$name=DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, "US");
print_r($name);
?>

在本地主机中工作正常。但是当我在线尝试时,我收到错误致命错误:第 1 行未定义的类常量“PER_COUNTRY”

4

2 回答 2

3

那是 PHP 5.3 或更高版本的函数。因此,您的实时服务器上的服务器版本不是 >= PHP 5.3

见这里:http ://www.php.net/manual/en/datetimezone.listidentifiers.php

于 2012-12-20T10:45:17.810 回答
2

检查您的 PHP 版本:PER_COUNTRY 是在 5.3.0 中添加的

于 2012-12-20T10:46:45.577 回答