我在php.ini文件中有这个条目:
date.timezone = 'Europe/London';
Run Code Online (Sandbox Code Playgroud)
但每次我在命令行脚本中使用DateTime()时,我仍然会收到以下错误:
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 any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected 'Europe/London' for 'BST/1.0/DST' instead
Run Code Online (Sandbox Code Playgroud)
因此,我必须在任何脚本中执行以下操作才能使其工作:
date_default_timezone_set('Europe/London');
Run Code Online (Sandbox Code Playgroud)
还有什么可能导致此错误?
UPDATE
我在命令行和Web浏览器中使用了以下内容:
<?php
var_dump(ini_get('date.timezone'));
exit;
Run Code Online (Sandbox Code Playgroud)
在命令行中我得到:
string(0) ""
Run Code Online (Sandbox Code Playgroud)
在网络浏览器中,我得到:
string(13) "Europe/London"
Run Code Online (Sandbox Code Playgroud) 正如标题所暗示的,我想检查Magento生成的完整配置XML树.
我查看了配置对象,看不到这样做的方法.
如何才能做到这一点?