php版本大于7.0可以用如下方式: try{ //code }catch (\Error | \Exception $e){ //处理异常 } 捕获所有异常和错误 try{ //code }catch (\Throwable $e){ //处理 }