当前位置:中国飞客联盟文章中心编程学习脚本语言 → PHP 编码规范(17)

PHP 编码规范(17)

减小字体 增大字体 作者:风未起时  来源:中国站长学院  发布时间:2007-12-28 4:05:24
6.9 try...catch语句

一个try-catch语句应该具有如下格式:
try {
  statements;
} catch (ExceptionClass e) {
  statements;
}

一个try-catch语句后面也可能跟着一个finally语句,不论try代码块是否顺利执行完,它都会被执行。
try {
  statements;
} catch (ExceptionClass e) {
  statements;
} finally {
  statements;
}