`[异常]DateTime::__construct():`依赖系统是不安全的';的时区设置


`[Exception] DateTime::__construct(): `It is not safe to rely on the system's timezone settings

我正在使用codeception(bdd)进行测试,但给出错误

[Exception]                                                                                                
  DateTime::__construct(): 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 

任何
方法,但您仍然收到此警告,您很可能拼错了时区标识符。

我们选择Europe/Helsinki代替EEST/3.0/DST

我能做什么吗?

您可以在运行此代码之前使用date_default_timezone_set('Europe/Istanbul');

对于其他时区,请检查PHP时区

这是PHP配置的问题,而不是Codeception本身的问题。

在命令行中运行$ php -i | grep 'Configuration File',然后导航到该文件夹。编辑php.ini并找到显示date.timezone的行,并将其设置为date.timezone = "Europe/Helsinki"