gpt4 book ai didi

PHP 警告 : date(): It is not safe to rely on the system's timezone settings. - OS X

转载 作者:行者123 更新时间:2023-12-05 08:27:36 25 4
gpt4 key购买 nike

每次在终端中运行命令时,我都会收到此警告。它从最近更新我所有的自制软件公式和更新 Composer 开始。我查看了它引用的文件,但不确定在这里做什么。

完整消息

PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/ste/.composer/vendor/hoa/core/Parameter.php on line 158

在 Parameter.php 的第 158 行我们有一个函数

/**
* Initialize constants.
*
* @return void
*/
public static function initializeConstants()
{
$c = explode('…', date('d…j…N…w…z…W…m…n…Y…y…g…G…h…H…i…s…u…O…T…U'));
self::$_constants = [
'd' => $c[0],
'j' => $c[1],
'N' => $c[2],
'w' => $c[3],
'z' => $c[4],
'W' => $c[5],
'm' => $c[6],
'n' => $c[7],
'Y' => $c[8],
'y' => $c[9],
'g' => $c[10],
'G' => $c[11],
'h' => $c[12],
'H' => $c[13],
'i' => $c[14],
's' => $c[15],
'u' => $c[16],
'O' => $c[17],
'T' => $c[18],
'U' => $c[19]
];

return;
}'

我根本不在 OS X 上使用 PHP。我的工作有时是通过 VM 或 MAMP 进行的,所以我不确定是否应该使用 Composer 的核心?

最佳答案

您需要设置时区,使用 php.ini 或 php 函数 date_default_timezone_set()

通过 php.ini:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/London

或者使用 php:

date_default_timezone_set("Europe/London");

关于PHP 警告 : date(): It is not safe to rely on the system's timezone settings. - OS X,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36371618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com