您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
webman-查詢構造器-offset,limit的用法
发布时间:2022-02-06 13:11:48编辑:雪饮阅读()
實例:
public function index(Request $request)
{
ini_set('memory_limit','4096M');
//offset / limit
$data= Db::table('ecms_news')
->offset(10)
->limit(5)
->get();
$offsetLimit=isset($data[0]) ? $data[0] : [];
var_dump($offsetLimit);
return response("ok");
}
構造的sql:
select * from `phome_ecms_news` limit 5 offset 10
在以前學習mysql時候基本都是limit單獨使用,後來接觸到offset反而有點膈應,但是實際上現在看來,就語義理解上,limit結合offset才是最好的。
實例被訪問時:
[root@localhost webman]# /usr/local/php734/bin/php -c /usr/local/php734/lib/php.ini start.php start
Workerman[start.php] start in DEBUG mode
----------------------------------------- WORKERMAN -----------------------------------------
Workerman version:4.0.26 PHP version:7.3.4
------------------------------------------ WORKERS ------------------------------------------
proto user worker listen processes status
tcp root webman http://0.0.0.0:8787 4 [OK]
tcp root monitor none 1 [OK]
---------------------------------------------------------------------------------------------
Press Ctrl+C to stop. Start success.
訪問了全局中間件!
object(stdClass)#53 (37) {
["id"]=>
int(89)
["classid"]=>
int(76)
["ttid"]=>
int(0)
["onclick"]=>
int(122)
["plnum"]=>
int(0)
["totaldown"]=>
int(0)
["newspath"]=>
string(10) "2015-02-11"
["filename"]=>
string(2) "89"
["userid"]=>
int(1)
["username"]=>
string(6) "雪饮"
["firsttitle"]=>
int(0)
["isgood"]=>
int(2)
["ispic"]=>
int(1)
["istop"]=>
int(0)
["isqf"]=>
int(0)
["ismember"]=>
int(0)
["isurl"]=>
int(0)
["truetime"]=>
int(1423614193)
["lastdotime"]=>
int(1423614193)
["havehtml"]=>
int(1)
["groupid"]=>
int(0)
["userfen"]=>
int(0)
["titlefont"]=>
string(0) ""
["titleurl"]=>
string(42) "/xuewuzhijing/xindebiji/2015-02-11/89.html"
["stb"]=>
int(1)
["fstb"]=>
int(1)
["restb"]=>
int(1)
["keyboard"]=>
string(0) ""
["title"]=>
string(69) "分享我的个人博客访问量如何做到IP从10到600的(图文)"
["newstime"]=>
int(1423614114)
["titlepic"]=>
string(78) "/d/file/xuewuzhijing/xindebiji/2015-02-11/a31dfcd2c2d6067e00f5fc1b2717efde.jpg"
["ftitle"]=>
string(0) ""
["smalltext"]=>
string(209) " 关于界面 我的个人博客总共展示了三个版本,界面也经历了由“简单”到“复杂”再到“简单”,颜色从“色泽单一”到“五"
["diggtop"]=>
int(0)
["push_weixin_material"]=>
int(0)
["push_baidu_last_time"]=>
int(0)
["push_weixin_material_last_time"]=>
int(0)
}
关键字词:webman,查詢構造器,offset,limit
相关文章
- webman-查詢構造器-groupBy與having的用法
- webman-查詢構造器-orderBy,随机排序的用法
- webman-查詢構造器-参数分组,whereExists的用法
- webman-查詢構造器-orWhereColumn 的用法
- webman-查詢構造器-whereColumn 的用法
- webman-查詢構造器-whereDate,whereMonth,whereDay,wh
- webman-查詢構造器-whereNull ,whereNotNull,orWhereN
- webman-查詢構造器-whereIn、whereNotIn、orWhereIn
- webman-查詢構造器-whereBetween 與 orWhereBetween
- webman-查詢構造器-閉包查詢、whereBetween 與 orWher