方法抛出异常

异常处理

<?php

//任何方法都可能抛出错误
function methodWithException() {
    throw new Exception("test exception");
}