我想在我的页面上放置分页,它适用于链接 2、3、4 等等。但是每次我点击第一个和 1 时,页面都会显示我禁止访问,第一个和 1 给我的链接是“palmydentist/admin/dentist/index/”。我认为问题是 /index/ 但我不知道如何解决它。如果我单击其他链接,例如 2“palmydentist/admin/dentist/index/2/”,它不会给我任何错误。
这是我在控制器中的代码
class dentist_list extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->database();
$this->load->model('Admin_model', 'Admin');
$this->load->library("pagination");
}
public function index($uri_segment="4")
{
if($this->session->userdata('admin_id'))
{
$data = array();
$config = array();
$config['base_url'] = base_url() . "admin/dentist_list/index/";
$config['total_rows'] = $this->Admin->record_count();
$config['per_page'] = 10;
$config['uri_segment'] = 4;
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(4) : 0;
$data["patient"] = $this->Admin->dentist_list($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$data['table_data'] = $data['patient']['td'];
$data['footer'] = $this->load->view('dentist_dashboard/footer','', true);
$this->load->view('admin/dentist_list', $data);
}
else
{
header('Location: ' . base_url() . 'admin');
}
}
}
不要介意模型...