try {
//好好干,出了问题不要怕,外面有人接应
} catch (HttpException $e) {
//时刻准备着,处理上面抛出的HTTP问题
} catch (Exception $e) {
//时刻准备着,处理他们都处理不了的问题
} finally {
//打扫战场,都收拾好了再走人
}
try 中 return 后 finally 会继续执行,如果 finally 中也有return,则最终返回值为 finally 中 return 的值。
try 中 die 或 exit 后 finally 不会执行。
网友评论