Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
具体的问题:
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.
谷歌一下:
警告:date():依靠系统的时区设置是不安全的。 您*必须*使用date.timezone设置或date_default_timezone_set()函数。 如果您使用这些方法中的任何一种,并且仍然收到此警告,则很可能是拼写错误的时区标识符。 我们现在选择了“UTC”时区,但请设置date.timezone来选择您的时区。
方法1:
(最好的方法)在php.ini里加上找到date.timezone项,去掉前面的";",添加设置date.timezone = "Asia/Shanghai",北京的时间也写成上海那个。
重启环境,然后出现如下问题:
Warning: date(): Invalid date.timezone value 'Asia/Beijing', we selected the timezone 'UTC' for now. in D:\Tomcat\apache-tomcat-7.0.77\webapps\webOne\qshxxkj\WEB-INF\php-bin\Wxpay\example\h5.php on line 16
在php.ini中date.timezone = "Asia/Shanghai",加上如下这句话即可:
date_default_timezone_set('UTC');
重启服务即可。
方法2:
在需要用到这些时间函数的时候,在页面添加date_default_timezone_set("PRC");
方法3:
在页头加上设置时区ini_set('date.timezone','Asia/Shanghai');
相关文章
- Is it possible to disable authentication Filter on one action in an MVC 5 controller?
- asp.net web api history and how does it work?
- [POST] What Is the Linux fstab File, and How Does It Work?
- 【IT小知识】扩容是什么意思?扩容的近义词有哪些?
- it 测试/开发工程师在等代码出结果的时候都会干什么?砖家说,久坐不动容易造成血栓
- 毕业两年,想跳槽,想延长IT生涯
- 【pip install】ERROR: Cannot uninstall 'xx'. It is a distutils installed project 的解决办法
- 【转】我是怎么找到电子书的 – IT篇
- 增长:IT运维发展趋势报告
- remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
- 国产IT彪起来了,后浪要将前浪拍死在沙滩上
- 管理云服务?扩展现有IT安全模式
- IT新职位要求提高软技能、业务头脑
- 任正非:智慧城市的IT向云架构转型
- 一个想法(续五):IT联盟创业计划:现阶段进度公示、疑问解答及进行中的计划
- IT人生知识分享:博弈论的理性思维
- 程序员离职后的代码没人敢接手 :15 张令人喷饭的 IT 趣图