[PHP错误异常]①④--记录和发送异常信息
作者:
子木同 | 来源:发表于
2017-09-15 11:34 被阅读12次<?php
class LoginException extends Exception
{
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
//error_log($this->getMessage(), 3, 'D:/error/testLoginException.log');
error_log($this->getTraceAsString(), 3, 'D:/error/testLoginException.log');
}
}
try {
$link = @mysql_connect('localhost', 'dfdfdf', 'fgfgfgf');
if (!$link) {
throw new LoginException('数据库连接失败');
}
} catch (LoginException $e) {
echo $e->getMessage();
}
![](https://img.haomeiwen.com/i2953340/ab8e1c453fc67afa.png)
Paste_Image.png
![](https://img.haomeiwen.com/i2953340/0a14eaf3f0f0368e.png)
Paste_Image.png
本文标题:[PHP错误异常]①④--记录和发送异常信息
本文链接:https://www.haomeiwen.com/subject/vdjssxtx.html
网友评论