Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 laravel 5 并具有以下数组:
array:3 [▼ 0 => 3, 1 => 4, 2 => 5 ]
现在我想从表中获取所有值/行,比如“X”,id 为 3,4,5
试试这个查询
$array = [ 0 => 3,1 => 4, 2 => 5]; $results = DB::table('x') ->whereIn('id',$array) ->get();
您可以查看 Laravel 5 的查询示例
$result=DB::table('x')->whereIn('id',[3,4,5])->get();