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


PHP logger::exception方法代碼示例

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


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

示例1: query

 function query($sql, $is_read = true)
 {
     $result = mysql_query($sql, self::$conn[$this->i]);
     $log = config('log', 'mysql');
     $log['is_record_sql'] and logger::sql($sql, $is_read);
     if ($result) {
         return $result;
     }
     $info = $sql . ' {' . mysql_error() . '}';
     $log['is_record_exception'] and logger::exception('mysql', $info);
     throw new Exception($info, 104);
 }
開發者ID:jiokss,項目名稱:framework,代碼行數:12,代碼來源:mysql.php

示例2: __construct

 function __construct($message, $code, $error = 0)
 {
     logger::exception('server', $code . ' : ' . $message);
     $this->error = $error;
     parent::__construct($message, $code);
 }
開發者ID:mjiong,項目名稱:framework,代碼行數:6,代碼來源:sException.php

示例3: socket

 static function socket($url, $data)
 {
     //解析url
     if (!is_array($url)) {
         $url = parse_url($url);
     }
     if (!isset($url["port"])) {
         $url['port'] = 80;
     }
     //打開socket
     $fp = fsockopen($url['host'], $url['port'], $error_no, $error_info, 30);
     if (!$fp) {
         $info = 'error:(' . $error_no . ')' . $error_info;
         logger::exception('socket', $info);
         throw new Exception($info, 107);
     }
     //組裝發送數據
     if (is_array($data)) {
         $data = http_build_query($data);
     }
     $data = trim($data);
     //構造頭部信息
     $head = 'POST ' . $url['path'] . " HTTP/1.0\r\n";
     $head .= 'Host: ' . $url['host'] . "\r\n";
     $head .= 'Referer: http://' . $url['host'] . $url['path'] . "\r\n";
     $head .= "Content-type: application/x-www-form-urlencoded\r\n";
     $head .= 'Content-Length: ' . strlen($data) . "\r\n\r\n";
     $head .= $data;
     //接收並返回結果
     fputs($fp, $head);
     $info = '';
     while (!feof($fp)) {
         $info = fgets($fp);
     }
     return json_decode($info, true);
 }
開發者ID:mjiong,項目名稱:framework,代碼行數:36,代碼來源:http.php

示例4: send

 static function send($to, $title, $content, $cc = '', $type = 'HTML')
 {
     $mail = self::get_instance();
     $from = config('from', 'mail');
     $mail->send_mails($to, $title, $content, $type, $from, $cc);
     if (self::$exception) {
         logger::exception('mail', implode(PHP_EOL, self::$exception));
     }
 }
開發者ID:jiokss,項目名稱:framework,代碼行數:9,代碼來源:mail.php

示例5: bootstrap

 static function bootstrap($controller, $method)
 {
     try {
         if ($controller && $method) {
             define('CURRENT_ACTION', substr($controller . ':' . $method, 2));
             if (property_exists($controller, 'static_class')) {
                 if (method_exists($controller, '__before')) {
                     call_user_func($controller . '::__before');
                 }
                 call_user_func(array($controller, $method), explode('/', URL_REQUEST));
                 if (method_exists($controller, '__after')) {
                     call_user_func($controller, '::__after');
                 }
             } else {
                 $object = new $controller();
                 if (method_exists($controller, '__before')) {
                     $object->__before();
                 }
                 call_user_func_array(array($object, $method), array(explode('/', URL_REQUEST)));
                 if (method_exists($controller, '__after')) {
                     $object->__after();
                 }
             }
         } else {
             throw new Exception('absent controller or method', 101);
         }
     } catch (Exception $e) {
         logger::exception('exception', $e->getCode() . ' : ' . $e->getMessage());
         if (preg_match('/^(similar|product)$/', ENVIRONMENT)) {
             if (http::is_ajax()) {
                 http::json(array('error' => 4, 'message' => $e->getMessage(), 'data' => null));
             } else {
                 http::abort($e->getMessage(), '', 10);
             }
         }
         debug::exception($e);
     }
 }
開發者ID:mjiong,項目名稱:framework,代碼行數:38,代碼來源:system.php


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