本文整理汇总了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;
}
示例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));
}
示例3: rollback
public static function rollback($conn)
{
try {
if (!empty($conn)) {
$conn->rollback();
}
} catch (Exception $e) {
Tool::logger(__METHOD__, __LINE__, "回滚事务失败:" . $e->getMessage());
throw $e;
}
}
示例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;
}
示例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();
}
示例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;
}
示例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"] . "\"}";
示例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;
}
示例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>";
}
示例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;
}
示例11: smtp_debug
function smtp_debug($message)
{
if ($this->debug) {
Tool::logger(__METHOD__, __LINE__, $message, _LOG_INFOR);
}
}
示例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;
}
示例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\": \"页面静态化失败\"}";
}
示例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\": \"数据保存成功\"}";
}
示例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\": \"查询参数异常\"}";