|
控制器的代码:
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Home extends CI_Controller {
- function _construct(){
- parent::_construct();
- header('Content-type:text/html; charset=utf-8');
- $this->load->database();
- $this->load->helper('url_helper');
- $this->load->library('pagination');
- }
- public function index(){
- $this->load->model('Ssqsearch');
- $config['base_url'] = 'http://www.fucai56.com/';
- $config['total_rows'] = $this->Ssqsearch->count_table();
- $config['per_page'] = 20;
- $this->pagination->initialize($config);
- $data['pageinfo']=$this->pagination->create_links();
- $limit=20;
- $offset=$this->uri->segment(3);
- $data['news'] = $this->Ssqsearch->show_data($limit,$offset);
- $this->load->view('header');
- $this->load->view('index',$data);
- $this->load->view('footer');
复制代码
一直提示第17行错误,初始化失败。
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Home:pagination
Filename: controllers/Home.php
Line Number: 17
Backtrace:
File: D:\web\ssq\application\controllers\Home.php
Line: 17
Function: _error_handler
File: D:\web\ssq\index.php
Line: 315
Function: require_once
但是我看手册,还有其他人的例子,都是这样初始化的。 $this->pagination->initialize($config); |
|