I've autoloaded a class, which is properly namespaced and PSR-0. I put it in app/lib/CI, and the class and it's filename are the same "DB". The class file itself includes a config file before the actual class:
require( 'config.php' );
class DB {
// ...
}
The class is clearly autoloading, because when I call the static method connect it does display an error message from inside ::connect(). The problem is, global variables that are inside the included config.php are not available inside the class::method.
So, to be clear, the array $connection_settings is inside config.php, but even when using:
global $connection_settings;
$connection_settings is not set inside the connect method.
Something interesting is that even though the class is autoloaded, if I include the class from the top of my routes.php file, everything works normally. So what am I not doing right to get autoloading to work the way I consider "normal"?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…