thinkphp-查询方法-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

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-查询方法
文章位置:http://kswsj.cn/article/pdphhh.html

其他资讯