Codeigniter自定义库和配置文件

Codeigniter : How to access $config custom array within a custom library, where the corresponding file names of the library and the config are named same ?

The custom config file must be auto loading : You can also pass parameters stored in a config file. Simply create a config file named identically to the class file name and store it in your application/config/ folder. Reference

myclass config file : Resides in config\myclass.php

$config [ 'myconfig' ] [ 'something' ] = 'my value';

MyClass library : Resides in library\MyClass\MyClass.php

In the constructor of MyClass: $this->ci =& get_instance ( );

If I do this var_dump ( $this->ci->config->item ( 'myconfig' ) [ 'something' ] );

Then it prints NULL.

But if I add the following line, then it works $this->ci->config->load('myclass');

Why the config file not auto loading ?

# ../config/myclass.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config = Array(
    'index1' => 'val1',
    'index2' => 'val2',
    .. and so on
);

in your controller:

$this->config->load('myclass');

Then try:

$this->config->item('itemName');