本文整理汇总了PHP中HttpStatus::emailStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpStatus::emailStatus方法的具体用法?PHP HttpStatus::emailStatus怎么用?PHP HttpStatus::emailStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpStatus
的用法示例。
在下文中一共展示了HttpStatus::emailStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an error.
*
* @param int $errorStatus Error status code
* @param string $errorMsg Error message
* @param string $errorFile Error script file
* @param int $errorLine Error script line
* @throws ApiException API exception
*/
public static function handle($errorStatus, $errorMsg, $errorFile, $errorLine)
{
// Build the complete error message
$mailMsg = '<b>--- Spotzi ErrorHandler ---</b>' . PHP_EOL . PHP_EOL;
$mailMsg .= 'Date: ' . Date::format() . PHP_EOL;
$mailMsg .= 'Error status: ' . $errorStatus . PHP_EOL;
$mailMsg .= 'Error message: ' . $errorMsg . PHP_EOL;
$mailMsg .= 'Script name: ' . $errorFile . PHP_EOL;
$mailMsg .= 'Line number: ' . $errorLine . PHP_EOL;
//$mailMsg .= 'Request referer: ' . REQUEST_REFERER . PHP_EOL;
//$mailMsg .= 'Request URL: ' . URL_BASE . ltrim(REQUEST_URI, '/') . PHP_EOL;
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$mailMsg .= 'User agent: ' . $_SERVER['HTTP_USER_AGENT'];
}
// Determine whether debug mode is active
if (debugMode()) {
// In case debug mode is active, set the error message as the frontend message
debugPrint($mailMsg);
} else {
// Send the error email when needed
if (HttpStatus::emailStatus($errorStatus)) {
// Prepare the error mailer
Mail::addMailer(EMAIL_HOST, EMAIL_PORT, EMAIL_ERROR_FROM, EMAIL_ERROR_FROM_PASSWORD, BRAND_PRODUCT);
// Send the error email
Mail::send(EMAIL_ERROR_RECIPIENT, EMAIL_ERROR_FROM, EMAIL_ERROR_SUBJECT, nl2br($mailMsg));
}
throw new ApiException($errorStatus, $errorMsg);
}
}