Posted on 2006-09-20 10:20
my 阅读(217)
评论(0) 编辑 收藏 所属分类:
php5
例子 20-1. 抛出一个异常
<?php
try {
$error
=
'Always throw this error'
; throw new
Exception
(
$error
);
echo
'Never executed'
;
} catch (
Exception $e
) { echo
'Caught exception: '
,
$e
->
getMessage
(),
"\n"
; }
echo
'Hello World'
;
?>
|