where()
普通查询(等值查询)
数组方式批量设置查询条件
$map['name'] = 'thinkphp';
$map['status'] = 1;
// 把查询条件传入查询方法
Db::table('think_user')->where($map)->select();
// 助手函数
db('user')->where($map)->select();
表达式查询(<>,>< ...)
$map['id'] = ['>',1];
$map['mail'] = ['like','%thinkphp@qq.com%'];
Db::table('think_user')->where($map)->select();
连表:
Db::table('think_artist')
->alias('a')
->join('think_work w','a.id = w.artist_id') //同时设置别名
->join('think_card c','a.card_id = c.id')
->select();