多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` $mysql = Db::getInstance()->init('pool'); ``` #### query 执行原生语句,$sql SQL语句,$pre 预加载数据,必须是数组 ``` $data = $mysql->query($sql,$pre=[]); ``` #### select($buildSql=false)查询,返回二维数组,$buildSql=true返回查询语句 ``` $data = $mysql->table('table')->field('f1,f2')->where('f1', 'between', '1,5')->order('f1', 'desc')->limit(0, 1)->select(); ``` #### find($buildSql=false) 查询 ,返回一维数组 ``` $data = $mysql->table('table')->field('f1,f2')->where('f1', 5)->find(); ``` #### column($field, $index = '', $buildSql = false) 列查询,$field查询字段,$index索引 ``` $data = $mysql->table('table')->field('f1,f2')->where('f1', 'between', '1,5')->order('f1', 'desc')->limit(0, 1)->select(); ``` #### value($field, $buildSql = false) 值查询,$field字段名 ``` $data = $mysql->table('table')->where('id',5)->find('name'); ``` #### count、sum、max、min、avg聚合查询 ``` $data = $mysql->table('table')->count('id'); ``` #### paginate($page = 1, $limit = 10, $buildSql = false) 分页,$page页码,$limit单页条数 ``` paginate($page = 1, $limit = 10, $buildSql = false) ``` #### 高级查询 ``` $mysql->table('table1 a')->field('a.id,b.name,c.age,')->join('table b','a.id=b.id','left')->join('table c','a.id=c.id','right')->whereOr('a.id','in','1,2,3')->where('c.age','in',[11,12])->group('a.name')->having('c.age','>',11)->order('a.id','desc')->limit(10)->select(); ```