getcode
Exception::getCode
Gets the Exception code
ENTITY
final
public
int
Exception::getCode
Returns the Exception code.
ENTITY ENTITY
ENTITY
Returns the exception code as int in Exception but possibly as other type in Exception descendants (for example as string in PDOException).
ENTITY
Exception::getCode example
<?php
try {
throw new Exception("Some error message", 30);
} catch(Exception $e) {
echo "The exception code is: " . $e->getCode();
}
?>
ENTITY
The exception code is: 30
ENTITY
Throwable::getCode
这篇文档对你有帮助吗?
谢谢你的反馈!