//查找vip_phone或vip_name或_id =1,且admin_id=1
//注意字段 _complex,_logic(示例中没此字段,具体可以到tp文档中查询)
<?php
$model = D("vips");
$where['vip_phone']=1;
$where['vip_name']=1;
$where['_id']=1;
$where['_logic']='or';
$map['_complex']=$where;
$map['admin_id']=1;
$result = $model->where($map)->select();
var_dump($result);
echo "<br>成功sql".$model->getLastsql()."<br>";
$map1['vip_phone|vip_name|_id']=1;
$map1['admin_id']=1;
$result1 = $model->where($map1)->select();
var_dump($result1);
echo "<br>成功sql".$model->getLastsql()."<br>";
return 0;
?>
ThinkPHP中的或,且结合查询方法
最新推荐文章于 2022-12-01 12:01:13 发布