3-23 3,334 views
<?php
header('Content-type:text/html;charset=utf-8');
$a = 1;
$b = 2;
try {
//结果为真,设置异常信息
if( $a < $b )
{
throw new Exception('a要大于b');
}
} catch (Exception $err) {
// 返回异常信息
echo $err->getMessage();
}
?>