tp3.2展示列表
public function get_list($where=array(),$field="",$order = "id desc"){
$field = empty($field)?"id,dy_url,start_num,end_num,is_pay,create_time,total_num,now_num,speed,status":$field;
$count=$this->where($where)->count();
$Page=get_page($count);
$data['page'] = $Page->show();
$data['list'] = $this->where($where)->field($field)->order($order)->limit($Page->firstRow.','.$Page->listRows)->select();
return $data;
}
/** * 获取分页 * @param int $count 数据总行数 */ function get_page($count){ $listRows = 10; $Page= new \Think\Page($count,$listRows); $Page->rollPage = 5; $Page->setConfig('prev','上一页'); $Page->setConfig('next','下一页'); $Page->setConfig('first','首页'); return $Page; }