PHP Warning: date(): It is not safe to rely on the system
在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这行,改成如下:
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy2295')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy2295>date.timezone = Asia/Shanghai
然后重启apache即可!
在php程序中解决,在你程序前段加上
我们可以在php页面中加入
或者
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy4835')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy4835>ini_set('date.timezone','asiashanghai');您可能感兴趣的文章:
PHP date()函数It is not safe to rely on the system s timezone settings
PHP Warning: date(): It is not safe to rely on the system
PHP警告date(): It is not safe to rely on the system
PHP5.3以上版本涉及时间的会报错 It is not safe to rely on the system's timezone settings.
php date()时间函数报错,时区问题解决 UTC PRC CST
PHP中设置时区方法总结
A Study of WebRTC Security
php Date()函数输出中文年月日时分秒
Apache Reference Manual (12)
IOCP Thread Pooling in C