RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
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();

新闻名称:thinkphp-查询方法
文章URL:http://cqwzjz.cn/article/pdphhh.html