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


PHP DB_Helper::getMaxAllowedPacket方法代碼示例

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


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

示例1: _notify

 /**
  * Notifies site administrators of the error condition
  *
  * @param  string $notify_msg The formatted error message
  * @param  string $notify_from Sender of the email
  * @param  string $notify_list Email addresses to whom send the error report.
  */
 private static function _notify(&$notify_msg, $notify_from, $notify_list)
 {
     $backtrace = debug_backtrace();
     array_splice($backtrace, 0, 2);
     foreach ($backtrace as $frame) {
         // avoid recursion?
         if (isset($frame['class']) && $frame['class'] == __CLASS__) {
             return;
         }
     }
     $time = time();
     $date = date('Y-m-d H:i:s', $time);
     $msg = "Hello,\n\n";
     $msg .= $notify_msg;
     // this checks that we're not running from commandline (cron for example)
     if (isset($_SERVER['REMOTE_ADDR'])) {
         $proto = 'http';
         if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) {
             $proto .= 's';
         }
         $url = "{$proto}://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}";
         if (isset($_SERVER['QUERY_STRING'])) {
             $url .= "?{$_SERVER['QUERY_STRING']}";
         }
         $msg .= "URL: {$url}\n";
         $msg .= "IP: {$_SERVER['REMOTE_ADDR']}\n";
         $login = Auth::getUserLogin();
         if ($login) {
             $msg .= "User: {$login}\n";
         }
         if (!empty($_SERVER['HTTP_REFERER'])) {
             $msg .= "Referer: {$_SERVER['HTTP_REFERER']}\n";
         }
         if (!empty($_SERVER['HTTP_USER_AGENT'])) {
             $msg .= "User-Agent: {$_SERVER['HTTP_USER_AGENT']}\n";
         }
         $msg .= "\n";
     }
     $msg .= "-- \nSincerely yours,\nAutomated Error_Handler Class";
     $max_allowed_packet = DB_Helper::getMaxAllowedPacket();
     // skip error details of an email notification about a query that
     // was bigger than max_allowed_packet + 1024
     if (strlen($msg) > $max_allowed_packet + 1024) {
         return;
     }
     $notify_list = str_replace(';', ',', $notify_list);
     $notify_list = explode(',', $notify_list);
     $subject = APP_SITE_NAME . ' - Error found! - ' . $date;
     foreach ($notify_list as $notify_email) {
         $mail = new Mail_Helper();
         $mail->setTextBody($msg);
         $mail->send($notify_from, $notify_email, $subject, 0, false, 'error');
     }
 }
開發者ID:dabielkabuto,項目名稱:eventum,代碼行數:61,代碼來源:class.error_handler.php


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