Exception::getCode
(PHP 5 >= 5.1.0)
Exception::getCode — 获取异常代码
说明
final public int Exception::getCode( void)
返回异常代码。
参数
此函数没有参数。
返回值
返回整型(integer)类型的异常代码。
范例
Example #1 Exception::getCode()示例
<?php
try {
throw new Exception("Some error message", 30);
} catch(Exception $e) {
echo "The exception code is: " . $e->getCode();
}
?>
以上例程的输出类似于:
The exception code is: 30
发表评论 取消回复