Explain:ThinkPHP 中 where條件 or,and 同時使用


Eg:('a'=1 and 'b'=2) or ('c'=3 and 'd'=4) and 'e'=5

解決方法

$condition1['a'] = 1;
$condition1['b'] = 2;
$condition2['c'] = 3;
$condition2['d'] = 4;
$condition['_complex'] = array(
    $condition1,
    $condition2,
    '_logic' => 'or'
);
$condition['e'] = 5;
D('模型')->where($condition)->select();

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM