date(): It is not safe to rely on the system's timezone settings
部署MetInfo企业网站管理系统(php开源项目)时报此警告。
运行环境: Apache服务器 + MySQL5.5 + PHP5.4.5
函数 string
date ( string$format
[,
int$timestamp
] ); 参考文档位置
date函数说明
it's a warning in PHP 5.4, looks like it could be a security issue:
date(): It is not safe to rely on the system's timezone settings. You arerequired 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.
例如,当调用date('Y');函数时会报此警告
解决方法1 : 在调用此方法之前,调用date_default_timezone_set("UTC");
解决方法2: 在php.ini中查找date.timezone 去掉前面的分号修改
|
作者:沙漏哟 出处:计算机的未来在于连接 本文版权归作者和博客园共有,欢迎转载,请留下原文链接 微信随缘扩列,聊创业聊产品,偶尔搞搞技术 |