CodeIgniter:未使用此代码加载库类

I am new to CodeIgniter and following one Nettuts premium tutorial how to build CMS in codeigniter.

Very first my application and system directories lies on different path out of public_html and set path in config.php file.

I have created two files Frontend_Controller.php and Admin_Controller.php and within those files created class as below.

application/My_Controller.php

class MY_Controller extends CI_Controller
{

    public $data = array();

    function __construct()
    {
        parent::__construct();

        $this->data['errors'] = array();
        $this->data['site_name'] = config_item('site_name');
    }
}

libraries/Frontend_Controller.php

class Frontend_Controller extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
    }
}

libraries/Admin_Controller.php

class Admin_Controller extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
    }
}

Now when I am trying to autoload above classes by writing an __autoload() function into config.php file but it doesn't load the files/classes

config.php

function __autoload($classname)
{
    if(strpos($classname, 'CI_' !== 0))
    {
        $file = APPPATH . 'libraries/' . $classname . '.php';

        if(file_exists($file) && is_file($file))
        {
            @include_once($file);
        }
    }
}

Can anyone help me to understand and resolve the issue... Thanks a lot

You can try with codeigniter autoload in application/config/autoload.php file like this :

`$autoload['libraries'] = array('database', 'session');`

for details see here: http://ellislab.com/codeigniter%20/user-guide/general/autoloader.html

You can also try with this one:

The snippets below look at the following locations for lowercase filenames: core/ libraries/ models/

function __autoload($class) 
{
  $path = array('core', 'libraries', 'models');

  if(strpos($class, 'CI_') !== 0) {
    foreach($path as $dir) {
      if (file_exists(APPPATH.$dir.'/'.strtolower($class).'.php'))
        include_once(APPPATH.$dir.'/'.strtolower($class).'.php');
    }
  }
}