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


PHP app::log方法代码示例

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


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

示例1: firewall

 private final function firewall($use = false)
 {
     if ($use) {
         try {
             $ip = array('127.0.0.2');
             return $this->IpBlacklist($ip)->SpiderBlock()->BusyBlock(array(1, 20));
         } catch (Exception $e) {
             $msg = $e->getMessage();
             app::log($msg, 'ERROR');
             return self::forbidden($msg);
         }
     }
     return $this;
 }
开发者ID:suconghou,项目名称:sprite,代码行数:14,代码来源:base.php

示例2: Error

function Error($errno, $errstr, $errfile = null, $errline = null)
{
    if ($errno == 404 || $errno == 500) {
        $str = "ERROR({$errno}) {$errstr}";
        $code = $errno;
    } else {
        $str = "ERROR({$errno}) {$errstr} at {$errfile} on line {$errline} ";
        $code = 500;
    }
    http_response_code($code);
    DEBUG && app::log($str);
    if (ERROR_PAGE_404 && ERROR_PAGE_500) {
        $errorRouter = array($GLOBALS['APP']['router'][0], $errno == 404 ? ERROR_PAGE_404 : ERROR_PAGE_500, $str);
        $errorController = is_file(CONTROLLER_PATH . $errorRouter[0] . '.php') ? $errorRouter[0] : DEFAULT_CONTROLLER;
        if (method_exists($errorController, $errorRouter[1])) {
            $GLOBALS['APP']['controller'][$errorController] = isset($GLOBALS['APP']['controller'][$errorController]) ? $GLOBALS['APP']['controller'][$errorController] : $errorController;
            if (!$GLOBALS['APP']['controller'][$errorController] instanceof $errorController) {
                $GLOBALS['APP']['controller'][$errorController] = new $errorController();
                ///实例化控制器
            }
            exit(call_user_func_array(array($GLOBALS['APP']['controller'][$errorController], $errorRouter[1]), array($str)));
            //传入参数
        } else {
            exit('No Error Handler Found In ' . $errorController . '::' . $errorRouter[1]);
        }
    } else {
        $trace = debug_backtrace();
        $h1 =& $str;
        $i = count($trace) - 1;
        $li = null;
        while ($i >= 0) {
            if (!isset($trace[$i]['file'])) {
                $i--;
                continue;
            }
            $trace[$i]['class'] = isset($trace[$i]['class']) ? $trace[$i]['class'] : null;
            $trace[$i]['type'] = isset($trace[$i]['type']) ? $trace[$i]['type'] : null;
            $li .= '<p>' . $trace[$i]['file'] . '=>' . $trace[$i]['class'] . $trace[$i]['type'] . $trace[$i]['function'] . '() on line ' . $trace[$i]['line'] . '</p>';
            $i--;
        }
        if (DEBUG != 2) {
            $h1 = 'Oops ! Something Error,Error Code:' . $errno;
            $li = '<p>If you are administartor,See the log for more information ! </p><p>Else please contact the administartor ! </p>';
        }
        $html = '<div style="margin:2% auto;width:80%;box-shadow:0px 0px 8px #555;padding:2%;font:14px Monaco,Comic Sans MS">';
        $html .= '<b>' . $h1 . '</b>' . $li;
        $html .= "</div>";
        exit($html);
    }
}
开发者ID:highestgoodlikewater,项目名称:spider-3,代码行数:50,代码来源:core.php

示例3: test

 function test()
 {
     app::log("test");
 }
开发者ID:hzgswangy,项目名称:finance_warehouse,代码行数:4,代码来源:home.php

示例4: assets

 /**
  * 资产配置,基金涨幅,每天抓取,所有基金
  */
 public function assets($code = 530008)
 {
     $url = "http://www.howbuy.com/fund/{$code}/";
     $html = file_get_contents($url);
     $pattern = '/class="nTab9 jjzf_content" id="nTab9_0" style="display: block;">([\\s\\S]*?)sfw_tips_c/';
     $data = array('increase' => '', 'increase_avg' => '', 'increase_300' => '', 'asset' => '', 'trade' => '');
     if (preg_match_all($pattern, $html, $matches)) {
         $text = $matches[0][0];
         if (preg_match_all('/区间回报<\\/td>([\\s\\S]*?)<\\/tr>/', $text, $matches2)) {
             $tmp = explode(PHP_EOL, $matches2[1][0]);
             $str = array();
             foreach ($tmp as $item) {
                 if (!empty(trim($item))) {
                     $str[] = trim(strip_tags($item));
                 }
             }
             $data['increase'] = implode('|', $str);
         } else {
             app::log("QUJIAN ERROR {$code}");
         }
         if (preg_match_all('/同类平均<\\/td>([\\s\\S]*?)<\\/tr>/', $text, $matches2)) {
             $tmp = explode(PHP_EOL, $matches2[1][0]);
             $str = array();
             foreach ($tmp as $item) {
                 if (!empty(trim($item))) {
                     $str[] = trim(strip_tags($item));
                 }
             }
             $data['increase_avg'] = implode('|', $str);
         } else {
             app::log("TONGLEI ERROR {$code}");
         }
         if (preg_match_all('/(沪深300|全债指数)<\\/td>([\\s\\S]*?)<\\/tr>/', $text, $matches2)) {
             $tmp = explode(PHP_EOL, $matches2[2][0]);
             $str = array();
             foreach ($tmp as $item) {
                 if (!empty(trim($item))) {
                     $str[] = trim(strip_tags($item));
                 }
             }
             $data['increase_300'] = implode('|', $str);
         } else {
             app::log("TONGLEI ERROR {$code}");
         }
     } else {
         app::log("Value Data Not Match {$code}");
     }
     //下面资产配置,行业配置
     $html = file_get_contents("http://static.howbuy.com/min/f=/upload/auto/script/fund/data_{$code}_v759.js");
     if (preg_match_all('/hyPieData(.*?)jjpmChartData=\\{/', $html, $matches)) {
         $text = $matches[0][0];
         if (preg_match_all('/hyPieData={(.*?)]/', $text, $matches2)) {
             $tmp = $matches2[1][0];
             $str = array();
             if (preg_match_all("/name:'(.*?)',y:([\\d.]+)\\}/", $tmp, $matches2)) {
                 $names = $matches2[1];
                 $percent = $matches2[2];
                 foreach ($names as $index => $item) {
                     $str[] = $item . ',' . $percent[$index];
                 }
                 $data['trade'] = implode('|', $str);
             }
         } else {
             app::log("ERROR FOUND hyPieData {$code}");
         }
         if (preg_match_all('/zcPieData={(.*?)]/', $text, $matches2)) {
             $tmp = $matches2[1][0];
             $str = array();
             if (preg_match_all("/name:'(.*?)',y:([\\d.]+)\\}/", $tmp, $matches2)) {
                 $names = $matches2[1];
                 $percent = $matches2[2];
                 foreach ($names as $index => $item) {
                     $str[] = $item . ',' . $percent[$index];
                 }
                 $data['asset'] = implode('|', $str);
             }
         } else {
             app::log("ERROR FOUND zcPieData {$code}");
         }
     } else {
         app::log("JS Data Not Match {$code}");
     }
     //store to mysql
     if (!empty($data['increase']) && !empty($data['increase_avg']) && !empty($data['increase_300'])) {
         $sql = "UPDATE `fund_data` SET `increase`=:increase,`increase_avg`=:increase_avg,`increase_300`=:increase_300,`asset`=:asset,`trade`=:trade,`update_date`=:update_date WHERE code='{$code}' ";
         $stm = DB::prepare($sql);
         $now = date('Y-m-d H:i:s');
         $stm->bindParam(':increase', $data['increase']);
         $stm->bindParam(':increase_avg', $data['increase_avg']);
         $stm->bindParam(':increase_300', $data['increase_300']);
         $stm->bindParam(':asset', $data['asset']);
         $stm->bindParam(':trade', $data['trade']);
         $stm->bindParam(':update_date', $now);
         $ret = $stm->execute();
         self::log("update {$code} increase asset trade => {$ret}");
     } else {
         self::log("ERROR DATA for {$code}", true);
//.........这里部分代码省略.........
开发者ID:hzgswangy,项目名称:finance_warehouse,代码行数:101,代码来源:mssql.php


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