开发者

Type-less catch block in PHP

开发者 https://www.devze.com 2023-01-09 00:16 出处:网络
Has PHP any ability 开发者_如何学运维to catch all types of exceptions in one catch block? Is there any way to do this:

Has PHP any ability 开发者_如何学运维to catch all types of exceptions in one catch block? Is there any way to do this:

try  
{  
throw new Exception; OR throw new MyException;  
}  
catch(???)  
{
// Catch both exception types  
}


Exception is the super class of all exceptions. So:

catch (Exception $e) {
    // Catches any exception
}
0

精彩评论

暂无评论...
验证码 换一张
取 消