• php 记录错误日志


    /**
    * 记录错误日志
    * @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 $file ";
    error_log($res_real, 3, $address);
    $res = var_export($res,true);
    $res = $res." ";
    error_log($res, 3, $address);
    } else {
    $res_real = "$error_date $file $res ";
    error_log($res_real, 3, $address);
    }
    }
  • 相关阅读:
    MVC ActionResult JsonResult
    xml文件
    使用socket实现聊天功能
    使用多线程完成Socket
    Socket编程
    U1总结
    多线程
    IO
    单例模式
    日期
  • 原文地址:https://www.cnblogs.com/gaogaoxingxing/p/13601700.html
Copyright © 2020-2023  润新知