调用很方便,使用listinfo方法,如果小于1页不会返回分页字符串
$page = $_GET['page'] ? intval($_GET['page']) : '1';
$products = $this->product_db->listinfo($where,'', $page, 10);
$pages = $this->product_db->pages;
listinfo方法
/**
* 查询多条数据并分页
* @param $where
* @param $order
* @param $page
* @param $pagesize
* @return unknown_type
*/
final public function listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array(), $data = '*') {
$where = to_sqls($where);
$this->number = $this->count($where); // 获取总数
$page = max(intval($page), 1); // 当前页
$offset = $pagesize*($page-1); // 位移,每页数据数目