ThinkPHP“逻辑或”关系的多条件查询

thinkPHP连贯操作时,有时会用到多个条件的查询。thinkPHP默认条件下的多条件查询的逻辑关系是"与"。
以下是逻辑"或"的示例代码
$where['count1'] = $count1;
$where1['count1'] = $count1;
$where2['count2'] = $count2;
$data = $demoModel->where(array($where1,$where2,'_logic'=>'or'))->select();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章