tp3.2复合查询

$where['member.ming'] = array('like',"%$key%");
$where['xueyuan.xingming'] = array('like',"%$key%");
$where['xueyuan.dizhi'] = array('like',"%$key%");
$where['xueyuan.shoujihao'] = array('like',"%$key%");
$where['_logic'] = 'or';
$map['_complex'] = $where;
$map['status']  = array('eq',3);
$model = D('YuanView');
$count  = $model->where($map)->count();// 查询满足要求的总记录数
$Page = new \Think\Pagehome($count,2);// 实例化分页类 传入总记录数和每页显示的记录数(15)
foreach($map as $key=>$val) {
    $Page->parameter[$key]   =   urlencode($val);
}
$show = $Page->show();// 分页显示输出
$post = $model->where($map)->limit($Page->firstRow.','.$Page->listRows)->order('id desc')->select();
$this->assign('xueyuan', $post);
$this->assign('page',$show);
就是这么写,显示模糊查询在组装成数组,这样就行了

你可能感兴趣的:(THINKPHP,3.2)