这是我的分页函数,在该函数下编写分页代码,我在另一个函数中调用了这个分页函数(abc(offset=0)),login_process在else if part中,并传递了abc函数值以查看函数login_process和login_view内的admin_view,我使用了分页代码,并且获取的数据以分页显示,但是当我单击链接1 2或任何然后出现时错误 在此服务器上找不到请求的 URL/简洁/welcome/abc/1。并且未暗示分页我的分页功能代码:
public function abc($offset = 0){
$this->load->model('insert_model');
//$data ['query'] = $this->insert_model->view_data();
$this->load->library('table');
// Load Pagination
$this->load->library('pagination');
// Config setup
$config['base_url'] = base_url().'/welcome/abc';
$items= $config['total_rows'] = 20;
$perpage=$config['per_page'] = 1;
// I added this extra one to control the number of links to show up at each page.
$config['num_links'] = 5;
// Initialize
$this->pagination->initialize($config);
// Query the database and get results
// Here we add the limit and the offset
// The second parameter is the limit, since we are showing
// 10 per page, the limit should be 10
$data['books'] = $this->db->get('register',5, $offset);
// Create custom headers
$header = array('id','username','lastname','email' , 'password', 'image','status');
// Set the headings
$this->table->set_heading($header);
// Load the view and send the results
return $data['books'];
}
我的login_process函数,我在其中调用了 ABC 并将其值传递给 admin_view(仅查看其 elseif 部分)
public function login_process()
{
$this->load->model('insert_model');
$data['users'] = array(
'fname' => $this->input->post('fname'),
'pass'=> $this->input->post('pass'),
);
$status= $this->insert_model->login_test($data);
$st['ss']=$this->insert_model->stat($data);
//print "<pre>"; print_r($status); die();
if($status == true && $st['ss'] [0] ['status'] == 0)
{
$ses = array(
'username' => $this->input->post('fname'),
'password' => $this->input->post('pass'),
);
$this->session->set_userdata($ses);
$im['pic']=$this->insert_model->image_fetc();
$this->load->view('header_view',$im);
$this->load->view('navside_view');
$this->load->view('user_view');
}
elseif($status == true && $st['ss']['0'] ['status'] == 1)
{
$ses = array(
'username' => $this->input->post('fname'),
'password' => $this->input->post('pass'),
);
$this->session->set_userdata($ses);
$im['pic']=$this->insert_model->image_fetc();
// print_r($aaa); die();
// $data['aa'] = "sd";
$data['books'] = $this->abc();
$this->load->view('header_view',$im);
$this->load->view('navside_view');
$this->load->view('admin_view', $data);
}
else
{
$this->load->view('header_view');
$this->load->view('navside_view');
$this->load->view('center_view_login');
}
}
我的admin_view代码
echo $this->table->generate($books); ?>
<?php echo $this->pagination->create_links(); ?>
请检查我做错了什么..
我有一个类似的问题,当我在我的应用程序/配置/路由中添加控制器函数的路径时.php它得到了解决 file
类似于:
$route['terse/welcome/abc/(:num)'] = 'terse/welcome/abc';
自定义它。希望对您有所帮助。