PHP 的 strtotime() 函数本身不支持多种语言环境。但是,您可以使用 DateTime 类和 IntlDateFormatter 类来实现类似的功能,同时支持多种语言环境。
以下是一个使用 DateTime 和 IntlDateFormatter 的示例:
<?php// 设置时区date_default_timezone_set('UTC');// 创建一个 DateTime 对象$date = new DateTime('2021-06-01 12:00:00');// 创建一个 IntlDateFormatter 对象,指定语言环境、日期格式和时间格式$formatter = new IntlDateFormatter('zh_CN', IntlDateFormatter::FULL, IntlDateFormatter::FULL);// 使用 IntlDateFormatter 对象格式化日期$formattedDate = $formatter->format($date);echo $formattedDate; // 输出:2021年6月1日星期二 中午12:00:00 UTC?>在这个示例中,我们使用了 IntlDateFormatter 类来格式化日期,并指定了语言环境为 “zh_CN”(简体中文)。您可以根据需要更改语言环境参数。


