laravel打印执行的sql语句

Laravel 打印SQL语句
DB::connection()->enableQueryLog();#开启执行日志
$a = self::where(['investorid'=>$id])->whereBetween('inserttime',[$start,$end])->where('deposit','>',0)->orderBy('id','asc')->Paginate(20);
 print_r(DB::getQueryLog());   //获取查询语句、参数和执行时间

 

你可能感兴趣的:(laravel打印执行的sql语句)