Home >Backend Development >PHP Tutorial >Yii2 ARwhere查询 orWhere 和orFilterWhere 啥区别呢??

Yii2 ARwhere查询 orWhere 和orFilterWhere 啥区别呢??

WBOY
WBOYOriginal
2016-06-06 20:16:201841browse

Yii2 ARwhere查询 orWhere 和orFilterWhere 啥区别呢??

回复内容:

Yii2 ARwhere查询 orWhere 和orFilterWhere 啥区别呢??

filter的操作内部会过滤掉为空的条件

  • null

  • ''

  • 空数组

比如查询条件:

<code>orFilterWhere([
    'status' => 0,
    'name' => '',
    'age' => null,
    'sex' => []
 ])</code>

最后去掉为的组成查询条件,依据规则就剩下status = 0这个条件了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn