您好,欢迎访问一九零五行业门户网

PHP中设置时区,记录日志文件的实现代码_PHP教程

复制代码 代码如下:
getmessage());
}
//record operation log into .log file
function logger($log_content)
{
    print_r(date('h:i:s'). .$log_content.
);
    $log_filename = date(ymd)..log;
    $file = fopen($log_filename ,a+);
    fwrite($file, date('h:i:s'). .$log_content.\r\n);
    fclose($file);
}
//record operation log into .log file
function logger2($log_content)
{
    global $max_size;  
    print_r(date('h:i:s'). .$log_content. .
);
    $log_filename = date(ymd)..log;
    if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){unlink($log_filename);sleep(1);}
    file_put_contents($log_filename, date('h:i:s'). .$log_content. .\r\n, file_append);
}
//error handler function
function myhandler($level, $message, $file, $line, $context)
{
    logger([error] level: $level, message: $message, file: $file, line: $line, content: $context);
    die();
}
?>
原文网址:http://txw1958.cnblogs.com/
http://www.bkjia.com/phpjc/326379.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/326379.htmltecharticle复制代码 代码如下: html body ?php date_default_timezone_set('asia/hong_kong'); //set time zone set_error_handler(myhandler); //set error handler $chinatime = date('y-m-d...
其它类似信息

推荐信息