PHP Warning: date(): It is not safe to rely on the system_PHP教程
程序员文章站
2022-06-17 16:34:28
...
昨天碰到使用date()函数时出现PHP Warning: date(): It is not safe to rely on the system出现这种错误是因为php5默认date.timezone为utc,改为date.timezone = PRC即可.下面看我的方法总结。
在php程序中运行时报如下警告信息:
PHP 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
主要是时区没有设置的缘故,调整很简单,
打开php.ini文件,并找到date.timezone这行,改成如下:
代码如下 | 复制代码 |
date.timezone = Asia/Shanghai |
然后重启apache即可!
在php程序中解决,在你程序前段加上
我们可以在php页面中加入
代码如下 | 复制代码 |
date_default_timezone_set('asia/shanghai'); |
或者
代码如下 | 复制代码 |
ini_set('date.timezone','asiashanghai'); |
上一篇: 3g-网易-邮箱-数据库设计
下一篇: 还是个改错的有关问题-异常已经知道了
推荐阅读
-
PHP date()函数警告: It is not safe to rely on the system解决方法
-
PHP Warning: date(): It is not safe to rely on the system_PHP教程
-
PHP date()函数警告: It is not safe to rely on the system解决方法
-
php提示PHP Warning: date(): It is not safe to rely on the......安全错误的解决办法
-
PHP Warning: date(): It is not safe to rely on the system_PHP教程
-
php提示PHP Warning: date(): It is not safe to rely on the......错误的解决办法_PHP教程
-
php Warning: phpinfo(): It is not safe to rely on the systems timezone settings.解决方法
-
php提示PHP Warning: date(): It is not safe to rely on the......错误的解决办法_PHP教程
-
php如何设置时间,php.ini如何设置时间,PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
-
PHP date()函数警告: It is not safe to rely on the system解决方法_PHP