Db::name()->where()->find();
Db::name()->where()->select();
db()->where()->find();
db()->where()->select();
Db::name()->where("id","exp",">1 AND name = 'bbb'")->select();
Db::name()->where('id','>=',4)->where("nickname","like","%bbb%")->select();
Db::view('User','id,name')
->view('Profile','truename,phone,email','Profile.user_id=User.id')
->view('Score','score','Score.user_id=Profile.id')
->where('score','>',80)
->select();
Db:name()->where()->update();
db()->where()->update();
Db:name()->where()->delete();
db()->where()->delete();
Db::name()->insert();
Db::name()->insertGetId();
Db::name()->insertAll();
db()->insert();
db()->insertAll()
Db::query('sql语句');
Db::execute('sql语句');
Db::transaction(function(){
//逻辑代码
Db::name()->find();
Db::name()->delete();
});
Db::name()->where()->count();
Db::name()->where()->max();
Db::name()->where()->min();
Db::name()->where()->avg();
Db::name()->where()->sum();
//控制器
// 查询每页显示10条数据
$list = Db::name()->where()->paginate('每页显示条数','总记录数');
// 把分页数据赋值给模板变量list
$this->assign('list', $list);
// 渲染模板输出
return $this->fetch();
//模板中使用
{volist name='list' id='user'}
- {$user.nickname}
{/volist}
{$list->render()}