【发布时间】:2014-02-20 15:19:40
【问题描述】:
我有几个例外:
fooException extends Exception{}
barException extends Exception{}
tarException extends Exception{}
这里是异常处理程序
set_exception_handler('get_exceptions');
function get_exceptions($msg){
# how to get the exception name here like
# fooException barException
}
示例错误
if(0){
throw new fooException;
}
if(!1){
throw new barException;
}
现在,在get_exceptions 函数中,我正在尝试但无法获取抛出的异常类型,而不是消息、代码和整个数据。只是类的名称,如fooException 或barException 无论如何只能获取触发异常的名称?
【问题讨论】:
标签: php oop exception exception-handling