Php 找不到下一页404的codeigniter分页
索引页运行良好,但当我单击第2页时,它显示404页未找到 控制器Php 找不到下一页404的codeigniter分页,php,codeigniter,Php,Codeigniter,索引页运行良好,但当我单击第2页时,它显示404页未找到 控制器 public function index() { $config = array(); $config['base_url'] = base_url('admin/booking'); $total_row = $this->booking_m->record_count(); $config["total_rows"] = $total_row; $config["per_page"]
public function index() {
$config = array();
$config['base_url'] = base_url('admin/booking');
$total_row = $this->booking_m->record_count();
$config["total_rows"] = $total_row;
$config["per_page"] = 1;
$config['use_page_numbers'] = TRUE;
$config['num_links'] = $total_row;
$config['cur_tag_open'] = ' <a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
$this->pagination->initialize($config);
if($this->uri->segment(3)){
$page = ($this->uri->segment(3)) ;
}
else{
$page = 1;
}
$data["info"] = $this->booking_m->fetch_data($config["per_page"], $page);
$str_links = $this->pagination->create_links();
$data["links"] = explode(' ',$str_links );
$this->load->view('admin/booking/index',$data);}
使用inspect->element检查第二个页面重定向到的url。使用inspect->element检查第二个页面重定向到的url。您缺少配置。将其置于配置中
$config['uri_segment'] = 3;
而不是此配置
$config['use\u page\u numbers']=TRUE编码>然后重试,您错过了一个配置。将其置于配置中
$config['uri_segment'] = 3;
而不是此配置$config['use\u page\u numbers']=TRUE编码>并尝试如果不尝试,您是否设置了路线
$route['admin/booking/(:any)'] = 'controllername/function/$1';
您的基本url应该如下所示
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
$config['base_url'] = 'http://localhost/yourproject/';
如果您的url中有IP地址,那么某些链接可能不起作用,这就是为什么设置url并使用localhost而不是IP是好的
另外,请确保按照此处解释的类和文件名的第一种方式进行操作如果不尝试,是否设置了路由
$route['admin/booking/(:any)'] = 'controllername/function/$1';
您的基本url应该如下所示
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
$config['base_url'] = 'http://localhost/yourproject/';
如果您的url中有IP地址,那么某些链接可能不起作用,这就是为什么设置url并使用localhost而不是IP是好的
另外,请确保按照此处解释的类和文件名的第一种方式进行操作Yes我更改了base url$config['base_url']=base_url('l0gadmin/booking/index');还有你的代码。现在我确定页面工作正常,但第2页未显示数据。请检查我的模型函数。那么您现在的问题是什么?是的,我更改了base url$config['base_url']=base_url('l0gadmin/booking/index');还有你的代码。现在我确定页面工作正常,但第2页未显示数据。请检查我的模型功能。那么你现在有什么问题?