旗下导航:搜·么
当前位置:网站首页 > PHP框架 > YII > 正文

YII2中andWhere怎样多个or查询【yii框架教程】,yii2,andWhere,or

作者:搜搜PHP网发布时间:2019-11-29分类:YII浏览:79


导读:YII2中andWhere怎样多个or查询运用多个or的庞杂查询:AND((`name`='张三')OR(`name`='李四')OR(`name`='王五'...

YII2中andWhere怎样多个or查询

运用多个or的庞杂查询:

AND ((`name`='张三') OR (`name`='李四') OR (`name`='王五'))
// AND ((`name`='张三') OR (`name`='李四') OR (`name`='王五'))
$query->andWhere(['or',
    ['name' => '张三'],
    ['name' => '李四'],
    ['name' => '王五']
]);
AND (((name=‘张三’) AND (phone=‘15200000000’)) OR ((name=‘李四’) AND (phone=‘15300000000’)))
// AND (((`name`='张三') AND (`phone`='15200000000')) OR ((`name`='李四') AND (`phone`='15300000000')))
$query->andWhere(['or',
    ['and',
        ['name' => '张三'],
        ['phone' => '15200000000']
    ],
    ['and',
        ['name' => '李四'],
        ['phone' => '15300000000']
    ]
]);

引荐:《YII教程》

以上就是YII2中andWhere怎样多个or查询的细致内容,更多请关注ki4网别的相干文章!

标签:yii2andWhereor