How to set or get config variables in Codeigniter?

255 Views

How to set or get config variables in 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 “application/config/config.php” file.

 


 

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

 <?php

// 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.

 <?php

// Getting value of config variable in Codeigniter.
$this->config->item('variable_name');

?>

 

Tags:-
Codeigniter