为什么我点击分页的1234都没反应,他直接显示我所有的数据
controllers的代码
<?php
class Information extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('information_model');
$this->load->helper('url_helper');
}
public function a()
{
$data['information'] = $this->information_model->get_information();
$config['base_url'] = base_url().'index.php/information/a';
$config['total_rows'] = 8;
$config['per_page'] = 2;
$config['first_link'] = '首页';
$config['last_link'] = '尾页';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '<p>';
$this->table->set_heading('id','bb','cc','dd','ee','ff','gg');
$this->pagination->initialize($config);
$this->load->view('information/a',$data);
}
}
model代码
<?php
class information_model extends CI_Model {
public function __construct()
{
$this->load->database();
}
public function get_information()
{
$query = $this->db->get('information');
return $query->result_array();
}
}
view代码
<!DOCTYPE html>
<html>
<body>
<?php echo $this->table->generate($information);?>
<?php echo $this->pagination->create_links();?>
</body>
</html> |