Lar*_*are 2 php mysql laravel laravel-query-builder
我需要使用'限制'从数据库获取数据如何在laravel中执行此操作?雄辩
->limit($value)
Run Code Online (Sandbox Code Playgroud)
只需要一个值,但我需要得到一个范围.我的意思是例如在请求中我发送起点和范围:
0 and 10 (i want to start getting records from first and get next 10)
Run Code Online (Sandbox Code Playgroud)
然后
10 and 10 (i want to start getting records from 10th and get next 10)
Run Code Online (Sandbox Code Playgroud)
在MySQL中查询它可能使得LIMIT 0, 10 / LIMIT 10, 10
laravel的方法是什么?->limit(0,10)?
你可以这样做,
$users = DB::table('users')
->offset(10)
->limit(5)
->get();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1017 次 |
| 最近记录: |