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


PHP ErrorHandler::getErrorMessage方法代码示例

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


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

示例1: runner_mail

function runner_mail($params)
{
    $customSMTP = "0";
    if ($customSMTP == "1") {
        include_once getabspath('libs/phpmailer/class.phpmailer.php');
        include_once getabspath('libs/phpmailer/class.smtp.php');
        return runner_mail_smtp($params);
    }
    $from = isset($params['from']) ? $params['from'] : "";
    if (!$from) {
        $from = "";
    }
    $to = isset($params['to']) ? $params['to'] : "";
    $body = isset($params['body']) ? $params['body'] : "";
    $cc = isset($params['cc']) ? $params['cc'] : "";
    $bcc = isset($params['bcc']) ? $params['bcc'] : "";
    $replyTo = isset($params['replyTo']) ? $params['replyTo'] : "";
    $priority = isset($params['priority']) ? $params['priority'] : "";
    $charset = "";
    $isHtml = false;
    if (!$body) {
        $body = isset($params['htmlbody']) ? $params['htmlbody'] : "";
        $charset = isset($params['charset']) ? $params['charset'] : "";
        if (!$charset) {
            $charset = "utf-8";
        }
        $isHtml = true;
    }
    $subject = $params['subject'];
    //
    $header = "";
    if ($isHtml) {
        $header .= "MIME-Version: 1.0\r\n";
        $header .= 'Content-Type: text/html;' . ($charset ? ' charset=' . $charset . ';' : '') . "\r\n";
    }
    if ($from) {
        if (strpos($from, '<') !== false) {
            $header .= 'From: ' . $from . "\r\n";
        } else {
            $header .= 'From: <' . $from . ">\r\n";
        }
        @ini_set("sendmail_from", $from);
    }
    if ($cc) {
        $header .= 'Cc: ' . $cc . "\r\n";
    }
    if ($bcc) {
        $header .= 'Bcc: ' . $bcc . "\r\n";
    }
    if ($priority) {
        $header .= 'X-Priority: ' . $priority . "\r\n";
    }
    if ($replyTo) {
        if (strpos($replyTo, '<') !== false) {
            $header .= 'Reply-to: ' . $replyTo . "\r\n";
        } else {
            $header .= 'Reply-to: <' . $replyTo . ">\r\n";
        }
    }
    $eh = new ErrorHandler();
    set_error_handler(array($eh, "handle_mail_error"));
    $res = false;
    if (!$header) {
        $res = mail($to, $subject, $body);
    } else {
        $res = mail($to, $subject, $body, $header);
    }
    restore_error_handler();
    return array('mailed' => $res, 'errors' => $eh->errorstack, "message" => nl2br($eh->getErrorMessage()));
}
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:70,代码来源:phpfunctions.php

示例2: returnError

 /**
  * This function is used to standardize the communication between the classes. All the error responses between
  * the classes should be of this format.
  *
  * Please use this for all the communications between the classes. Interactions within a class can be of any kind.
  *
  * @see ErrorHandler
  * @param $code integer should be a valid code from the ErrorHandler class or a code with a message.
  * @param null $message string if the code exists in the ErrorHandler class the message associated with it will bw returned.
  * @return array the array will have error_code and the message in it.
  */
 protected function returnError($code, $message = null)
 {
     $message = $message === null ? ErrorHandler::getErrorMessage($code) : $message;
     $this->putLog("Error {$code}: {$message}");
     return array('error' => $code, "message" => $message);
 }
开发者ID:sh9zad,项目名称:phpbasics,代码行数:17,代码来源:Base.php


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