public function getUserData(){
//连接数据库
$this->load->database();
//实列化模型
$this->load->model('user_model','user');
//获取user表总记录数
$total=$this->user->getCount();
$perpage=2;
//载入分页类
$this->load->library('pagination');
//配置分页类连接
$config['base_url'] =site_url('user/getUserData');
//分页设置
$config['total_rows'] =$total;
$config['per_page'] =$perpage;
//设置上下页
$config['next_tag_open'] = '<font color="red">';
$config['next_tag_close'] = '</font>';
$config['prev_link']='上一页';
$config['next_link'] ='下一页';
//实例化
$this->pagination->initialize($config);
//获取分页页码
$page=$this->pagination->create_links();
//设置偏移量
$offset=$this->uri->segment(3);
$userData=$this->user->getUserData($perpage,$offset);
}
//连接数据库
$this->load->database();
//实列化模型
$this->load->model('user_model','user');
//获取user表总记录数
$total=$this->user->getCount();
$perpage=2;
//载入分页类
$this->load->library('pagination');
//配置分页类连接
$config['base_url'] =site_url('user/getUserData');
//分页设置
$config['total_rows'] =$total;
$config['per_page'] =$perpage;
//设置上下页
$config['next_tag_open'] = '<font color="red">';
$config['next_tag_close'] = '</font>';
$config['prev_link']='上一页';
$config['next_link'] ='下一页';
//实例化
$this->pagination->initialize($config);
//获取分页页码
$page=$this->pagination->create_links();
//设置偏移量
$offset=$this->uri->segment(3);
//调用模型方法
$userData=$this->user->getUserData($perpage,$offset);
//获取配置文件中的路径设置
$viewPath=$this->config->item('viewPath');//获取视图,赋值变量
$this->load->view('user/getUserData',array('userData'=>$userData,'viewPath'=>$viewPath,'page'=>$page));}