thinkphp-查询方法
1.where方法进行AND条件查询
Db::table('think_user')->where('name','like','%thinkphp')->where('status',1)->find();
2.where方法多字段相同条件的AND查询
Db::table('think_user')->where('name&title','like','%thinkphp')->find();
3.whereOr方法进行OR查询
Db::table('think_user')->where('name','like','%thinkphp')->whereOr('title','like','%thinkphp')->find();
4.whereOr方法多字段相同条件的OR查询
Db::table('think_user')->where('name|title','like','%thinkphp')->find();
5.where方法和whereOr方法在复杂的查询条件中配合使用
$result=Db::table('think_user')->where(function($query){$query->where('id',1)->whereor('id',2);})->whereOr(function($query){$query->where('name','like','think')->whereOr('name','like','thinkphp');})->select();
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。