是否可以将数组用作函数DB的值:
->whereMonth($month);
像这样:->whereMonth([01, 02, 12]);
答案 0 :(得分:3)
whereMonth does not support arrays, and the first argument is the column name, not the value.
https://laravel.com/api/5.3/Illuminate/Database/Query/Builder.html#method_whereMonth
You can instead use whereIn with a raw expression:
->whereIn(DB::raw('MONTH(column)'), [1,2,3])