我是codeigniter的新手。我正在使用分頁。分頁鏈接顯示正常,但是當我點擊任何鏈接時,我即將註銷。 這裏是我的代碼,並請檢查是否有任何修正需要codeigniter分頁鏈接重定向到註銷頁面
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Packages extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('admin_packages');
$this->load->model('common_model');
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('pagination');
$this->load->library('common');
}
function packages()
{
if(!$this->session->userdata('userid'))
redirect('index.php/users/login');
$ofset=0;
$config['base_url']='http://localhost/index.php/vehicles/packages/';
$config['total_rows']=$this>common_model>get_countt('packages_purchased','user_id',$this->session->userdata('userid'));
$config['per_page'] = '10';
$config['use_page_numbers'] = TRUE;
$config['full_tag_open'] = '<p align="center">';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
if($this->uri->segment(3))
$ofset=($this->uri->segment(3)-1)*$config['per_page'];
$uid=$this->session->userdata('userid');
$bal=$this->vehicle->available_balance($uid);
$arr['balanc']=$bal->mots;
$arr['dtee']=$bal->dt;
$arr['pack']=$this->common_model->get_alldetails('packages','status',1);
$arr['det']=$this->vehicle->purchased_packages($this->session->userdata('userid'),$ofset,$config['per_page']);
$arr['page_title']='Reminder | Automated TEXT and Email Alerts for Garage Owners';
$this->breadcrumb->append_crumb("My Account<span> › <span>Packages", '/page');
$this->load->template('vehicles/purchased_packages',$arr);
}
嘗試在您的site_url()函數中遺漏index.php /。 – thpl
不,它沒有工作 – kumar
你的分頁產生了什麼鏈接?你能否提供一個最終URI結構的例子,就像它在網站上一樣? – thpl