ѡ̳

标题: model类新增联合查询带分页的方法multi_listinfo [打印本页]

作者: admin    时间: 2018-4-20 18:24
标题: model类新增联合查询带分页的方法multi_listinfo
libs /  classes  / model.class.php  

新增
public function multi_listinfo($where = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array()) {
        //$sql = preg_replace('/select([^from].*)from/i', "SELECT COUNT(*) as count FROM ", $where);
       // $this->query($sql);
       // $c = $this->db->fetch_next();      //$this->number = $c['count'];
       $this->query($where);
     $c = $this->count();  
     $this->number = $c;
        $page = max(intval($page), 1);
        $offset = $pagesize*($page-1);
        $this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);

        $r = $this->query($where.' LIMIT '.$offset.','.$pagesize);
        while(($s = $this->db->fetch_next()) != false){
            $data[] = $s;
        }
        return $data;
    }











欢迎光临 ѡ̳ (http://www.sunminxuan.cn/bbs/) Powered by Discuz! X3.4