您的位置:首页 > 编程语言 > PHP开发

ThinPHP try catch抛出异常

2016-04-06 13:24 621 查看
function test1(){
  
  try {

            $error = 'Always throw this error';

            throw new \Think\Exception($error);

            echo 'Never executed';

            

       } catch (Exception $e) {

            echo 'Caught exception: ', $e->getMessage(), "\n";

       }

            echo 'Hello World';
   
}

抛出异常的简单实例
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: