[ECShop] date_default_timezone_get():It is not safe to rely on the system's timezone settings."_解决方案

问题描述

利用PhpStudy搭建ECShop环境,配置系统时,在浏览器也没的顶部出现以下异常信息提示:

Warning: date_default_timezone_get(): 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 X:\...\WWW\ECshop36\ecshop\install\includes\lib_installer.php on line 223


问题分析

以上异常信息大致意思:使用date_default_timezone_get()函数所获取的服务器时区是不安全的,对应服务端上的配置文件是...\WWW\ECshop36\ecshop\install\includes\目录下的 lib_installer.php 文件


解决方案

在服务端找到...\WWW\ECshop36\ecshop\install\includes\目录下的 lib_installer.php 文件,用Notepad++编辑器打开该文件,然后在代码区最开始的位置增加一句代码:

 /**
 *设置默认的时区
 */
date_default_timezone_set('Asia/Shanghai');

保存后,再次到浏览器前端刷新页面。
此时报错提示已经消失,页面底部的【杂项】-设置时区:从最初报错时的"UTC"变成了"亚洲,中国,上海"

你可能感兴趣的:([ECShop] date_default_timezone_get():It is not safe to rely on the system's timezone settings."_解决方案)