如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
事务操作 DB::beginTransaction(); try { DB::insert(...); DB::insert(...); DB::insert(...); DB::commit(); // all good } catch (\Exception $e) { DB::rollback(); // something went wrong } 打印sql // DB::connection()->enableQueryLog();#开启执行日志 $r_parm = objectToArrayLaravel(Db::table('product_sku_info_parm')->select('info_id',DB::raw('count(id) as sumii')) ->where($where) ->where(function ($query) use ($orWhere) { $query->orWhere($orWhere); }) ->orderBy("sumii","desc") ->groupBy('info_id')->first()); // print_r(DB::getQueryLog()); |