Defining and using your own configurations

CI enables us to define our own configurations and easily access them via the config class. For example, with application/config/my_config.php, let's say we define a parameter in that config file as follows:

$param1 = "value1";

We can easily access our configuration file parameters to load all the parameters into the array:

$array = $this->config->load('my_config', TRUE);

The second parameter, TRUE, assures us that our configuration parameters will be defined in an array prefixed with the configuration file name.

Consider: $param1 = $array['my_config']['param1'];

or: $param1 = $this->config->item('param1', 'my_config'),.

$param1 will have the value value1 that we have set in the configuration file that we built.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.79.84