Welcome Guest, Not a member yet? Register   Sign In
Library confusion
#1

[eluser]Unknown[/eluser]
I Love CI, and I'm trying to understand how it works. One thing that puzzles me is if I initialize the Session class manually in a controller:

$this->load->library('session');

The first thing the Session __construct does is check to see if $config['encryption_key'] == ''

But how does it know what $config is? The session class doesn't extent any other class, it seems like it should be encapsulated, and have no knowledge of the $config var.

Basically, if you'd please excuse my ignorance, I'd like to know how $config is passed to this (Session) class. Any explanation you could provide would be very much appreciated.

Cheers,
Dave
#2

[eluser]umefarooq[/eluser]
hi $config is coming from you config.php which is in application config folder, just find in config.php file you can set encryption key there
#3

[eluser]InsiteFX[/eluser]
When CodeIgniter Loads all it's stuff it also builds a config
the config array from config.php into it's core.

This is how it knows the config items in other libraries etc.

You can read about it here in the Codeigniter User Guide.

CodeIgniter User Guide - Config Class

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB