laravel獲取查詢中的sql內容

  DB::enableQueryLog();
  $last_month_cost = DB::table('ds_dwb_game_summary')
       ->where("userid","in",$tuple_uid)
       ->whereRaw("ds>={$start} and ds<= {$end}")
       ->sum('cost');
   dd(DB::getQueryLog());

這樣就可以看到所有的查詢情況

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章