Beispiel #1
0
/**
 * 自定义的错误处理函数,将 PHP 错误通过文本消息回复显示
 * @param  int $level   错误代码
 * @param  string $msg  错误内容
 * @param  string $file 产生错误的文件
 * @param  int $line    产生错误的行数
 * @return void
 */
function errorHandler($level, $msg, $file, $line)
{
    $error_type = array(E_WARNING => 'Warning', E_NOTICE => 'Notice', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Strict', E_RECOVERABLE_ERROR => 'Recoverable Error', E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated');
    $moreRequestMessage = getMoreRequestMessage();
    $fromusername = $moreRequestMessage["fromusername"];
    $tousername = $moreRequestMessage["tousername"];
    $errorMessage = "PHP报错了:\n" . $error_type[$level] . ":\n" . $msg . "\nFILE:\n" . $file . "\nLINE:\n" . $line;
    sendTextMessage($fromusername, $tousername, $errorMessage);
}
Beispiel #2
0
 public function sendTextMessage($content)
 {
     sendTextMessage($this->fromusername, $this->tousername, $content);
 }