當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tool::logger方法代碼示例

本文整理匯總了PHP中Tool::logger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::logger方法的具體用法?PHP Tool::logger怎麽用?PHP Tool::logger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tool的用法示例。


在下文中一共展示了Tool::logger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getValueByKey

 public static function getValueByKey($key, $valueType = _STRING)
 {
     $config = "";
     try {
         if (empty($key)) {
             throw new Exception("參數異常!");
             Tool::logger(__METHOD__, __LINE__, "參數異常!");
         }
         if (empty(self::$configs)) {
             self::$configs = Tool::readConfig();
         }
         if (isset(self::$configs[$key])) {
             $config = self::$configs[$key];
             if ($valueType === _BOOL) {
                 //bool類型
                 $config = $config == TRUE;
             } else {
                 if ($valueType === _INT) {
                     //int類型
                     if (is_numeric($config)) {
                         $config = intval($config);
                     } else {
                         $config = -1;
                     }
                 }
             }
         }
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, sprintf("讀取配置文件失敗: %s", $e->getMessage()));
     }
     return $config;
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:32,代碼來源:Config.php

示例2: actionEdit

 /**
  * 編輯
  */
 public function actionEdit($id)
 {
     $model = parent::_model(new Article(), $id);
     $addonarticle = parent::_model(new Addonarticle(), $id);
     if (isset($_POST['Article'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST['Article'];
             if (!$model->save()) {
                 Tool::logger('article', var_export($model->getErrors(), true));
                 throw new CException('文章更新失敗');
             }
             $addonarticle->attributes = $_POST['Addonarticle'];
             if (!$addonarticle->save()) {
                 Tool::logger('article', var_export($addonarticle->getErrors(), true));
                 throw new CException('文章附表更新失敗');
             }
             $this->redirect(array('list'));
         } catch (Exception $e) {
             Tool::logger('article', $e->getMessage());
             $transaction->rollback();
         }
     }
     $this->render('edit', array('model' => $model, 'addonarticle' => $addonarticle));
 }
開發者ID:njz817,項目名稱:ycms,代碼行數:28,代碼來源:ArticleController.php

示例3: rollback

 public static function rollback($conn)
 {
     try {
         if (!empty($conn)) {
             $conn->rollback();
         }
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "回滾事務失敗:" . $e->getMessage());
         throw $e;
     }
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:11,代碼來源:DBHelp.php

示例4: rcount

 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from p_sort where 1=1";
         if (is_numeric($query->sortId) && $query->sortId > 0) {
             $sql = $sql . sprintf(" and sort_id=%u", $query->sortId);
         }
         if (strlen($query->sortName) > 0) {
             $sql = $sql . sprintf(" and p.sortName = ''", $query->sortName);
         }
         Tool::logger(__METHOD__, __LINE__, sprintf("查詢產品類型總數SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("查詢產品類型總數%u.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查詢數據失敗:" . $e->getMessage());
         throw new Exception("查詢數據失敗:" . $e->getMessage());
     }
     return _NONE;
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:29,代碼來源:Sort.php

示例5: get

 public static function get($companyKey)
 {
     $company = new Company();
     if (empty($companyKey)) {
         Tool::logger(__METHOD__, __LINE__, "參數為空", _LOG_DEBUG);
         throw new Exception("參數為空");
     }
     try {
         $query = new Company();
         $query->companyKey = $companyKey;
         $query = new Content(_QUERY_ALL);
         $query->contentKey = $companyKey;
         $query->contentType = "company";
         $content = Content::read($query);
         if (!empty($content)) {
             $company->id = $content->contentId;
             $company->companyKey = $content->contentKey;
             $company->subject = $content->subject;
             $company->content = $content->content;
             $company->mFile = $content->mImage;
             $company->contentType = $content->contentType;
         }
         return $company;
     } catch (Exception $e) {
         throw $e;
     }
     return new Company();
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:28,代碼來源:Company.php

示例6: rcount

 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from doc_file where 1=1";
         if (is_numeric($query->fileId) && $query->fileId > 0) {
             $sql = $sql . sprintf(" and file_id=%u", $query->fileId);
         }
         if (strlen($query->inModule) > 0) {
             $sql = $sql . sprintf(" and in_module='%s'", $query->inModule);
         }
         if (strlen($query->fileKey) > 0) {
             $sql = $sql . sprintf(" and file_key='%s'", $query->fileKey);
         }
         if (strlen($query->savedPath) > 0) {
             $sql = $sql . sprintf(" and saved_path='%s'", $query->fileKey);
         }
         Tool::logger(__METHOD__, __LINE__, sprintf("查詢圖片總數SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::free($data);
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("文件共%u條記錄.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查詢數據失敗:" . $e->getMessage());
         throw $e;
     }
     return _NONE;
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:36,代碼來源:DocFile.php

示例7: strtolower

<?php

include "../include/common.php";
Tool::print_request(__METHOD__, __LINE__);
Tool::logger(__METHOD__, __LINE__, $_SERVER["QUERY_STRING"], _LOG_DEBUG);
$_SESSION["CURRENT_PAGE"] = $default;
if (isset($_REQUEST["page"])) {
    $page = strtolower($_REQUEST["page"]);
    $queryStr = "";
    /*
    foreach($_GET as $key => $value){
    	if(strtolower($key) != "page"){
    		$queryStr .= sprintf("&%s=%s", $key, $value);
    	}
    }
    
    if(!empty($queryStr)){
    	$queryStr = sprintf("?%s", substr($queryStr, 1));
    }
    */
    $_SESSION["CURRENT_PAGE"] = sprintf("pages/%s", $pages[$page]);
}
echo "{\"status\":\"true\", \"data\": \"" . $_SESSION["CURRENT_PAGE"] . "\"}";
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:23,代碼來源:route.php

示例8: rcount

 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from message where 1=1";
         Tool::logger(__METHOD__, __LINE__, sprintf("查詢文本內容總數SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("查詢文本內容 總%u.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查詢數據失敗:" . $e->getMessage());
         throw new Exception("查詢數據失敗:" . $e->getMessage());
     }
     return _NONE;
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:23,代碼來源:Message.php

示例9: sprintf

                                }
                                DocFile::delete($file);
                            }
                        }
                    }
                    $docFile->showedName = $oldName;
                    $docFile->extName = $extName;
                    $docFile->savedPath = $upload_dir . $fileName;
                    $docFile->fileDesc = $fileDesc;
                    $docFile->fileUrl = $fileUrl;
                    $docFile->fileSort = $fileSort;
                    DocFile::insert($docFile);
                    $result = $upload_dir . $fileName;
                    //上傳成功
                    Tool::logger(__METHOD__, __LINE__, sprintf("上傳文檔[%s]成功", $result), _LOG_INFOR);
                }
            } catch (Exception $e) {
                Tool::logger(__METHOD__, __LINE__, sprintf("上傳文檔失敗:%s", $e->{$getMessage}()), _LOG_ERROR);
            }
        } else {
            $is_upload = false;
            $result = "文件上傳失敗";
            Tool::logger(__METHOD__, __LINE__, "文件上傳失敗", _LOG_ERROR);
        }
    }
}
if (empty($formId)) {
    echo "<script language=\"javascript\" type=\"text/javascript\">parent.BS_Popup.closeAll({status:\"" . $is_upload . "\", data: \"" . $result . "\"});</script>";
} else {
    echo "<script language=\"javascript\" type=\"text/javascript\">parent.BS_Upload.Forms['" . $formId . "'].uploadCompleted({status:\"" . $is_upload . "\", data: \"" . $result . "\"});</script>";
}
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:31,代碼來源:upload.php

示例10: sprintf

require_once "../include/common.php";
require_once "../include/3rd/email.class.php";
//郵箱服務器配置
$emailServer = Config::getValueByKey("EMAIL_SERVER");
//服務器
$emailPort = Config::getValueByKey("EMAIL_PORT");
//服務器端口
$from = Config::getValueByKey("EMAIL_FROM");
//發件人
$user = Config::getValueByKey("EMAIL_USER");
//帳號
$password = Config::getValueByKey("EMAIL_PASSWORD");
//密碼
//郵件內容
$to = $message->email;
//收件人
$title = Config::getValueByKey("REPLY_TITLE");
//主題
$content = sprintf("<h1>%s</h1>", $message->reply);
//內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
$smtp = new smtp($emailServer, $emailPort, true, $user, $password);
//true表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = true;
//是否顯示發送的調試信息
$state = $smtp->sendmail($to, $from, $title, $content, $mailtype);
Tool::logger(__METHOD__, __LINE__, sprintf("郵件發送: %s", $state), _LOG_INFOR);
if (!empty($state)) {
    $emailResult = true;
}
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:31,代碼來源:email.php

示例11: smtp_debug

 function smtp_debug($message)
 {
     if ($this->debug) {
         Tool::logger(__METHOD__, __LINE__, $message, _LOG_INFOR);
     }
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:6,代碼來源:email.class.php

示例12: total

 public static function total()
 {
     try {
         $num = _NONE;
         $sql = "select sum(visit_count) as num from countor where 1=1";
         Tool::logger(__METHOD__, __LINE__, sprintf("統計訪問總數SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $num = $row["num"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("統計訪問總數%u.", $num), _LOG_DEBUG);
         return $num;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "統計訪問總數失敗:" . $e->getMessage());
         throw new Exception("統計訪問總數失敗:" . $e->getMessage());
     }
     return _NONE;
 }
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:23,代碼來源:Countor.php

示例13: sprintf

	}*/
if (empty($result)) {
    $result = Tool::staticPage(sprintf("%s/index.php", $source), sprintf("%s\\index.html", $target));
    //首頁
    Tool::logger(__METHOD__, __LINE__, "首頁靜態化成功", _LOG_DEBUG);
}
if (empty($result)) {
    Tool::staticPage(sprintf("%s/company.php", $source), sprintf("%s\\company.html", $target));
    //公司信息
    Tool::logger(__METHOD__, __LINE__, "公司信息靜態化成功", _LOG_DEBUG);
}
if (empty($result)) {
    Tool::staticPage(sprintf("%s/culture.php", $source), sprintf("%s\\culture.html", $target));
    //企業文化
    Tool::logger(__METHOD__, __LINE__, "企業文化靜態化成功", _LOG_DEBUG);
}
if (empty($result)) {
    Tool::staticPage(sprintf("%s/honor.php", $source), sprintf("%s\\honor.html", $target));
    //企業榮譽
    Tool::logger(__METHOD__, __LINE__, "企業榮譽靜態化成功", _LOG_DEBUG);
}
if (empty($result)) {
    Tool::staticPage(sprintf("%s/spirit.php", $source), sprintf("%s\\spirit.html", $target));
    //企業風貌
    Tool::logger(__METHOD__, __LINE__, "企業風貌靜態化成功", _LOG_DEBUG);
}
if (empty($result)) {
    echo "{\"status\":\"true\", \"data\": \"頁麵靜態化完成\"}";
} else {
    echo "{\"status\":\"false\", \"data\": \"頁麵靜態化失敗\"}";
}
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:31,代碼來源:static.php

示例14: catch

                                            if (empty($user->loginName)) {
                                                $result = "用戶不存在";
                                            } else {
                                                if ($user->password != $password) {
                                                    $result = "原始密碼不正確";
                                                } else {
                                                    $user->password = $npassword;
                                                    User::update($user);
                                                }
                                            }
                                        } catch (Exception $e) {
                                            $result = $e->getMessage();
                                            Tool::logger(__METHOD__, __LINE__, sprintf("數據更新失敗: %s", $e->getMessage()), _LOG_ERROR);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
if (strlen($result) > 0) {
    Tool::logger(__METHOD__, __LINE__, "{\"status\":\"false\", \"data\": \"" . $result . "\"}", _LOG_DEBUG);
    echo "{\"status\":\"false\", \"data\": \"" . $result . "\"}";
} else {
    Tool::logger(__METHOD__, __LINE__, "{\"status\":\"true\", \"data\": \"數據保存成功\"}", _LOG_DEBUG);
    echo "{\"status\":\"true\", \"data\": \"數據保存成功\"}";
}
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:31,代碼來源:update.php

示例15: catch

                }
            }
            echo "{\"status\":\"true\", \"data\": " . $listJson . "}";
        } catch (Exception $e) {
            echo "{\"status\":\"false\", \"data\": \"" . $e->getMessage() . "\"}";
            Tool::logger(__METHOD__, __LINE__, sprintf("查詢文本內容: %s", $e->getMessage()), _LOG_ERROR);
        }
    } else {
        if ($dataType == "detail") {
            try {
                $listJson = "";
                if (isset($_REQUEST["messageId"])) {
                    $messageId = $_REQUEST["messageId"];
                    $message = new Message(_NONE);
                    $message->messageId = $messageId;
                    $message = Message::read($message);
                    $listJson = json_encode($message, JSON_UNESCAPED_UNICODE);
                }
                echo "{\"status\":\"true\", \"data\": " . $listJson . "}";
                Tool::logger(__METHOD__, __LINE__, "查詢留言詳細", _LOG_INFOR);
                Tool::logger(__METHOD__, __LINE__, sprintf("查詢留言詳細Json: %s", $listJson), _LOG_DEBUG);
            } catch (Exception $e) {
                echo "{\"status\":\"false\", \"data\": \"" . $e->getMessage() . "\"}";
                Tool::logger(__METHOD__, __LINE__, sprintf("查詢留言詳細: %s", $e->getMessage()), _LOG_ERROR);
            }
        }
    }
    exit;
}
Tool::logger(__METHOD__, __LINE__, "查詢參數異常", _LOG_ERROR);
echo "{\"status\":\"false\", \"data\": \"查詢參數異常\"}";
開發者ID:BassYang1,項目名稱:YueXinChina,代碼行數:31,代碼來源:query.php


注:本文中的Tool::logger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。