static function index()
{
try {
DB::beginTransaction();
throw new Exception('haha');
DB::commit();
} catch (Exception $e) {
//不会执行
DB::table('logs')->insert([
'description' => '发生数据库异常',
]);
logger($e->getMessage());
}
//不会执行
DB::table('logs')->insert([
'description' => '操作结束',
]);
}
``
网友评论