PHP Warning: strtotime()错误解决办法
php5.1.0开始,php.ini里加入了date.timezone这个选项,默认情况下是关闭的。显示的时间都是格林威治标准时间,和 北京时间差了正好8个小时。
解决方案是:
修改php.ini文件,查找 ;date.timezone = ,把前面的分号去掉在 “=”后面加上时区。
比如:
Asia/Chongqing (重庆),
Asia/Shanghai (上海),
Asia/Urumqi (乌鲁木齐),
Asia/Macao (澳门),
Asia/Hong_Kong (香港),
Asia/Taipei (台北),
PRC 中国
如
<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('copy6869')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy6869>date.timezone = PRC
也可以才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('copy3663')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy3663><?php
date_default_timezone_set('Asia/Chongqing');
echo date('Y-m-d H:i:s');
?>
相关推荐阅读
php中时间相差8小时的多种解决办法
http://www.111cn.net/phper/31/42398.htm
php 日期时差8小时间解决方法
http://www.111cn.net/phper/31/37224.htm
php获取服务器时间(解决8小时差距问题)
http://www.111cn.net/phper/31/34041.htm
您可能感兴趣的文章:
PHP Warning: file_get_contents failed to open stream解决办法
phpmyamdin安装出现Warning: require(./libraries/Error_Handler.class.php) 错误解决办法
PHP Warning: strtotime()错误解决办法
Warning: session_start() [function.session-start]
PHP出现Warning: scandir()问题的解决方法
php提示Warning: file_get_contents(): couldn’t resolve
php提示 Warning: touch() [function.touch]: Utime failed: Permission denied in错误
PHP warning Illegal offset type错误解决办法
Warning: mysql_fetch_assoc() expects parameter 1 to be resource解决方法
php错误提示 open_basedir restriction in effect 解决