当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::error_log方法代码示例

本文整理汇总了PHP中Log::error_log方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::error_log方法的具体用法?PHP Log::error_log怎么用?PHP Log::error_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


在下文中一共展示了Log::error_log方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCountRecFood

/**
 * count
 * @param Db $db
 * @return array
 */
function getCountRecFood(&$db)
{
    $sql = "select favor,cometrue from recommendedfood,users \n\t\t\twhere recommendedfood.user_id=users.user_id\n\t\t\tand users.school_id={$_POST['school_id']};";
    $res = $db->query($sql);
    if ($res !== false) {
        $return = array();
        $return['count'] = 0;
        $return['wish_satisfied_rate'] = 0.0;
        $return['lineover_rate'] = 0.0;
        $return['line'] = 500;
        //心愿线数量
        $return['count'] = sizeof($res);
        if ($return['count'] === 0) {
            return $return;
        }
        $linecount = 0;
        $truecount = 0;
        foreach ($res as $value) {
            if ($value['cometrue']) {
                $truecount++;
            }
            if ($value['favor'] >= 500) {
                $linecount++;
            }
        }
        $return['lineover_rate'] = $linecount / $return['count'];
        $return['wish_satisfied_rate'] = $truecount / $return['count'];
        return $return;
    } else {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        //错误日志
        exit;
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:40,代码来源:wish_statistics.php

示例2: countComments

function countComments(&$db, &$value)
{
    $res = $db->query("select count(*) from food_comments where canteen_id={$value['canteen_id']} and food_id={$value['food_id']};");
    if ($res === false) {
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        $db->close();
        exit;
    }
    $value['commentscount'] = $res[0]['count(*)'];
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:10,代码来源:count_ranking.php

示例3: getReply

function getReply(&$db, &$value)
{
    $sql = "select content,time from complaint_replies\n\twhere complaint_id={$value['complaint_id']};";
    $res = $db->query($sql);
    if ($res === false) {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        exit;
    } else {
        $value['reply'] = false;
        if (!empty($res)) {
            $value['reply'] = true;
            $value['reply_content'] = $res[0]['content'];
            $value['reply_time'] = $res[0]['time'];
        }
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:17,代码来源:get_complaints.php

示例4: getMethod

function getMethod(&$db, &$value)
{
    $sql = "select content,imageurl from foodmethod where recommend_id={$value['recommend_id']} order by sequence;";
    $res = $db->query($sql);
    if ($res !== false) {
        $value['content'] = array();
        $value['imagefile'] = array();
        if (empty($res)) {
            $value['content'] = null;
        }
        foreach ($res as $val) {
            $value['content'][] = $val['content'];
            $value['imagefile'][] = $val['imageurl'];
        }
    } else {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        exit;
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:20,代码来源:get_recommend_food.php

示例5: getJsonResponse

                            echo getJsonResponse(1, $db->error, null);
                            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
                            $db->rollback();
                            $db->close();
                            exit;
                        }
                    } else {
                        //上传图片失败
                        echo getJsonResponse(4, $uf->errorMsg, null);
                        $db->rollback();
                        //回滚
                        $db->close();
                        exit;
                    }
                }
            }
        }
        $db->commit();
        echo getJsonResponse(0, "success", array("complaint_id" => $complaint_id));
    } else {
        //插入失败
        echo getJsonResponse(1, $mysqli->error, null);
        $db->rollback();
        //回滚
        Log::error_log('database error:' . $mysqli->error . ' in ' . basename(__FILE__));
    }
    $db->close();
} else {
    echo getJsonResponse(2, "参数没有设置", null);
    exit;
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:31,代码来源:add_complaint.php

示例6: getJsonResponse

        $sql = "select * from upgrade where device_id={$_POST['device_id']};";
        $res = $db->query($sql);
        if ($res === false) {
            echo getJsonResponse(1, $db->error, null);
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        } else {
            if (empty($res)) {
                echo getJsonResponse(2, "id错", null);
            } else {
                if ($res[0]['major_version_number'] > $major || $res[0]['major_version_number'] == $major && $res[0]['minor_version_number'] > $max || $res[0]['major_version_number'] == $major && $res[0]['minor_version_number'] == $max && $res[0]['revision_number'] > $min) {
                    //需要更新
                    $return = array();
                    $return['newversion'] = $res[0]['major_version_number'] . '.' . $res[0]['minor_version_number'] . '.' . $res[0]['revision_number'];
                    $return['apkurl'] = $res[0]['apkurl'];
                    $return['upgrade_content'] = $res[0]['upgrade_content'];
                    echo getJsonResponse(0, "success", $return);
                } else {
                    echo getJsonResponse(3, "版本已为最新", null);
                }
            }
        }
        $db->close();
    } catch (Exception $e) {
        echo getJsonResponse(1, '数据库连接错误', null);
        Log::error_log("数据库连接错误");
        exit;
    }
} else {
    echo getJsonResponse(2, "参数错误", null);
    exit;
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:31,代码来源:version_upgrade.php

示例7: getAcceptRate

function getAcceptRate(&$db)
{
    $sql = "select count(*) from canteen_complaints where canteen_id={$_POST['canteen_id']};";
    $res = $db->query($sql);
    //食堂投诉数量
    if ($res === false) {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        //错误日志
        exit;
    } else {
        if ($res[0]['count(*)'] == 0) {
            return 100;
        }
        $sql2 = "select count(*) from canteen_complaints,complaint_replies where \n\t\t canteen_id={$_POST['canteen_id']} and canteen_complaints.complaint_id=complaint_replies.complaint_id;";
        $res2 = $db->query($sql2);
        //食堂回复数
        if ($res2 === false) {
            echo getJsonResponse(1, $db->error, null);
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
            //错误日志
            exit;
        } else {
            if ($res2[0]['count(*)'] == 0) {
                return 0;
            }
            return $res2[0]['count(*)'] / $res[0]['count(*)'];
        }
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:30,代码来源:canteen_info.php

示例8: checkExist

function checkExist(&$db, $which)
{
    $sql = '';
    if ($which == 'canteen') {
        $sql = "select count(*) from canteen_grade where user_id={$_POST['user_id']} and canteen_id={$_POST['canteen_id']};";
    } else {
        $sql = "select count(*) from food_grade where user_id={$_POST['user_id']} and canteen_id={$_POST['canteen_id']} and food_id={$_POST['food_id']};";
    }
    $res = $db->query($sql);
    if ($res === false) {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        //错误日志
        exit;
    } else {
        if ($res[0]['count(*)'] == 1) {
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:22,代码来源:score.php

示例9: getNew

function getNew(&$db, &$value)
{
    $sql = "select time>curdate()-3 from canteen_food where canteen_id={$_POST['canteen_id']} \n\t\t\tand food_id={$value['food_id']};";
    $res = $db->query($sql);
    if ($res === false) {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        //错误日志
        exit;
    } else {
        $value['new'] = $res[0]['time>curdate()-3'];
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:13,代码来源:food_list.php

示例10: checkUserName

function checkUserName(&$db, $username)
{
    $res = $db->query("select user_id from users where username='{$username}';");
    if ($res === false) {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        $db->close();
        exit;
    }
    if (empty($res)) {
        return false;
    } else {
        return true;
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:15,代码来源:common_func.php

示例11: getFavor

function getFavor(&$db, $userid, &$value)
{
    $sql = "select user_id from food_comments_favor where comment_id={$value['comment_id']} and user_id={$userid};";
    $res = $db->query($sql);
    if ($res !== false) {
        if (empty($res)) {
            $value['is_favor'] = false;
        } else {
            $value['is_favor'] = true;
        }
    } else {
        echo getJsonResponse(1, $db->error, null);
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        exit;
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:16,代码来源:get_food_comment.php

示例12: setContent

/**
 * 食物做法步骤
 * @param unknown $db
 * @param unknown $foodid
 * @param unknown $content
 */
function setContent(&$db, $recid, $content, $imagefile)
{
    if ($content == null) {
        return;
    }
    //$method=explode("||", $content);
    $method = json_decode($content, true);
    for ($i = 1; $i <= sizeof($method); $i++) {
        if (empty($imagefile[$i - 1])) {
            $imagefile[$i - 1] = 'http://' . getServerIp() . '/uploads/recommendedfood/default.jpg';
        }
        $sql = "insert into foodmethod values({$recid},{$i},'" . stringToDb($method[$i - 1]) . "','{$imagefile[$i - 1]}');";
        $res = $db->execute($sql);
        if (!$res) {
            echo getJsonResponse(1, $db->error, null);
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
            $db->rollback();
            $db->close();
            exit;
        }
    }
}
开发者ID:xiaoqinzhe,项目名称:eatBetter,代码行数:28,代码来源:add_recommend_food.php


注:本文中的Log::error_log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。