where 查询

where数组条件
数组方式有两种查询条件类型:关联数组和索引数组。

关联数组

// 传入一维数组作为查询条件
Db::table('think_user')->where([
	'name'	=>	'thinkphp',
    'status'=>	1
])->select(); 

索引数组

// 传入二维数组作为查询条件
Db::table('think_user')->where([
	['name','=','thinkphp'],
    ['status','=',1]
])->select(); 

// or
$map1 = [
        ['name', 'like', 'thinkphp%'],
        ['title', 'like', '%thinkphp'],
    ];
    
$map2 = [
        ['name', 'like', 'kancloud%'],
        ['title', 'like', '%kancloud'],
    ];    
    
Db::table('think_user')
    ->whereOr([ $map1, $map2 ])
    ->select();
原文地址:https://www.cnblogs.com/wangyuyanhello/p/13450935.html