java程序员学php -16 exception处理
写法与java风格一致
throw new Exception('exception', 33); //比java多了一个error_code
try{
$d -> doSecond();
}catch(Exception $e){
echo $e.getMessage();
}
不同点:
1.php里没有 throws Exception
2.php里的exception没有 checked exception 与 unchecked之分
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn