How to set or get config variables in Codeigniter?

by cristobal , in category: Technology , 3 years ago

How to set or get config variables in Codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by bailey_conroy , 3 years ago

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

Below is the way to set or get a config variable in Codeigniter

1
2
3
4
// Setting a config variable dynamically
$this->config->set_item('variable_name', value);
// Getting value of config variable in Codeigniter.
$this->config->item('variable_name');