function my_error_handler($e_number,$e_message,$e_file,$e_line,$e_vars){
global $debug,$contact_email;
$message = "一个错误出现在:'$e_file' 的第 $e_line 行: \n<br />$e_message\n<br />";
$message .= "日期/时间: " . date('n-j-Y H:i:s') . "\n<br />";
$message .= "<pre>" . print_r($e_vars,1) . "</pre>\n<br />";
if($debug){
echo '<p class="errer">' . $message . '</p>';
}else{
error_log($message,1,$contact_email);//发送邮件.
if(($e_number != E_NOTICE) && ($e_number < 2048)){
echo '<p class="error">发生系统错误!带来的不便我们深表歉意!</p>';
}
}
}
这个是自定义的错误处理
然后在用date("Y-m-d");就提示错误
date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 'UTC' for '8.0/no DST' instead
日期/时间: 4-1-2011 08:33:47
求解!!!
-----------------------------------
上句加在页面最上面~追问
其实我想搞明白是什么问题,如果不用自定义的错误处理程序就没有这个问题
直接echo都可以输出的,求教
其实只是个警告而已~
in case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead
日期/时间: 4-1-2011 08:33:47
为了避免你在再次使用这个方法的时候,再得到这个警告~建议你添加timezone定义。
在这个函数里面,我们选择使用'UTC' for '8.0/no DST' 而不是你在函数里面定义的->日期/时间: 4-1-2011 08:33:47
----------------------------
一个警告而已~不过,date_default_timezone_set(),在你要使用时间函数的时候,最好加上。
具体这个警告为嘛非在这个时候出现= = 估计和date('n-j-Y H:i:s') 这样的format有关@@
谢谢哈!