/**
* 记录错误日志
* @param 日志内容 $res
*/
function save_log($res) {
$err_date = date("Ymd", time());
$address = '/home/wwwroot/itservice/backend/tools';
if (!is_dir($address)) {
mkdir($address, 0700, true);
}
$address = $address.'/'.$err_date . '_autoload_itservice.log';
$error_date = date("Y-m-d H:i:s", time());
if(!empty($_SERVER['HTTP_REFERER'])) {
$file = $_SERVER['HTTP_REFERER'];
} else {
@$file = $_SERVER['REQUEST_URI'];
}
if(is_array($res)) {
$res_real = "$error_date\t$file\n";
error_log($res_real, 3, $address);
$res = var_export($res,true);
$res = $res."\n";
error_log($res, 3, $address);
} else {
$res_real = "$error_date\t$file\t$res\n";
error_log($res_real, 3, $address);
}
}