How to set or get config variables in Codeigniter?

Last updated 1 year, 6 months ago | 1049 views 75     5

Tags:- CodeIgniter

Codeigniter | SET or GET config variables

The config set_item() & item() functions are work for SET and GET a config variable in codeigniter


In Codeigniter, by default, all config variables are located at the “application/config/config.php” file.



The config class function set_item() is used to set a variable in Codeigniter 


// Setting a config variable dynamically
$this->config->set_item('variable_name', value);




The config class function item() is used to get a config variable value in Codeigniter.


// Getting value of config variable in Codeigniter.