• 日志函数


        //参数1:类型,参数2:code(定位),其它参数:值
        public function L()
        {
            $file = dirname(__FILE__)."/../../../Apps/".MODULE_NAME."/Log/".CONTROLLER_NAME.".txt";        
            $var_arr = func_get_args();
            $content_arr = array();
            foreach($var_arr as $k=>$value){
                if(!$k){
                    $type = $value;
                    continue;
                }
                if(1==$k){
                    $code = $value;
                    continue;
                }
                $value = json_encode($value);        
                $content_arr[] = $value;
            }
            if(!isset($type) || !isset($code)) return;
            
            $content = implode(" - ", $content_arr);
            $error_content = "【".$type."({$code})】-".date('Y-m-d H:i:s').":".$content."
    ";
            if( ThinkStorage::has($file) ){
                $content =  $str.ThinkStorage::read($file);
            }
            return ThinkStorage::put($file,$error_content);
        }
        private function L(){
            $var_arr = func_get_args();
            $content_arr = array();
            foreach($var_arr as $k=>$value){
                if(!$k){
                    $type = $value;
                    continue;
                }
                if(1==$k){
                    $code = $value;
                    continue;
                }
                //if(is_array($value) || is_object($value)){
                    $value = json_encode($value);
                //}        
                $content_arr[] = $value;
            }
            if(!isset($type) || !isset($code)) return;
            
            $content = implode(" - ", $content_arr);
            $error_content = "【".$type."({$code})】-".date('Y-m-d H:i:s').":".$content."
    ";
            error_log($error_content, 3, $this->log);
        }
  • 相关阅读:
    Angular 双向数据绑定
    Angular 过滤器
    Angular 自定义指令传参
    润滑油 标号
    Oracle concat
    sqlldr load UTF8 error
    linux中shell变量$#,$@,$0,$1,$2的含义解释
    shell 执行结果赋给变量
    linux 如何显示一个文件的某几行(中间几行)
    linux shell date 用当天时间做备份文件名
  • 原文地址:https://www.cnblogs.com/chy1000/p/4818689.html
Copyright © 2020-2023  润新知