thinkphp操作数据库

时间:2022-08-27 14:41:26

1.实现or操作:
$where=array(
'city'=>array('like',array('%'.$_GET['city'].'%'));
'hangye'=>array('like',array('%'.$_GET['hangye'].'%'));
);
2.实现既有or又有and的操作
$where['id']=array('neq',$_GET['id']);
$where['_string']="(city like '%".$_GET['city']."%) or (hangye like '%".$_GET['hangye']."%')";
或者
$where['city']=array('like','%'.$_GET['city'].'%');
$where['hangye']=array('like','%'.$_GET['hangye'].'%');
$where['_logic']='or';
$map['_complex']=$where;
$map['id']=array('gt',1);