I have an error when try upgrade codeigniter 1.7 to 2.X in the hook area

$this->CI->load->library('session');
$this->CI->load->model('administrator');

Those lines no working in my hook

Here my hook contructor

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Security
{
    private $CI;
    public function __construct ()
    {
        $this->CI =& get_instance();
        $this->CI->load->library('session');
    }

It's shows error in the library and in the model $this->CI->load->model('name_model');

I was follow the steps in codeigniter but the hooks no working, I'm check the config and everything is supose ok.

The hook not load the model and libraries. And I do not why.

有帮助吗?

解决方案

In order to upgrade CI from 1.7 to 2.X, you have to follow this complete tutorial.

http://ellislab.com/codeigniter/user-guide/installation/upgrade_200.html

Follow it exact step by, And for your reference in CI 2.X you have to Update your Class extension, means All core classes are now prefixed with CI_. Update Models and Controllers to extend CI_Model and CI_Controller, respectively.

$this->CI->load->library('session');
$this->CI->load->model('administrator');

These lines will not work in CI 2.X

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top