How to set or get config variables in Codeigniter?

Member

cristobal

by cristobal , in category: Technology , a month ago

How to set or get config variables in Codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by bailey_conroy , a month 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');