当前位置: 首页>>代码示例>>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;未经允许,请勿转载。