我用POST的方式怎么才能分页呢?

浏览:684 发布日期:2015/10/05 分类:求助交流
这是控制器中的代码public function index(){
        if(IS_POST){
        $Search=new \Home\Model\OrderModel();
        $result=$Search->Search();
        $count =count($result); 
        $Page =new \Think\Page($count,20);
        $map['brush']=I('post.brush');
        $starttime=strtotime(I('post.starttime'));
        $endtime=strtotime(I('post.endtime'));
        $map['datetime']= array(array('gt',$starttime),array('lt',$endtime)) ;
        foreach($map as $key=>$val) {
            $Page->parameter   .=   "$key=".urlencode($val).'&';
            var_dump($Page->parameter);
        }
        $page = $Page->show();
        $list   = $result;
        $this->assign("count",$count);
        $this->assign("page", $page);
        $this->assign("list", $list);
        }
        $this->display(); 
        }
这是模型中的public function search(){
        $order = M("order");
        $condition['brush'] = I('post.brush');
        $starttime=strtotime(I('post.starttime'));
        $endtime=strtotime(I('post.endtime'));
        $condition['datetime']= array(array('gt',$starttime),array('lt',$endtime)) ;
        $result=$order->where($condition)->select();
        return $result;
    }
因为我时间是一个时间段,请问怎么才可以搜索。还有。我控制器那边如果弄成不再次获取他们的值,怎么去简写呢?求大神帮忙
最佳答案
评论( 相关
后面还有条评论,点击查看>>