CodeIgniter Forums
Change dynamically setting variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Change dynamically setting variables (/showthread.php?tid=79000)



Change dynamically setting variables - AleJSON - 04-06-2021

Hi to everybody! I need to change the 'defaultLocale' var from a controller, in codeigniter 3 I couldĀ do that simply with this line:

$this->config->set_item('language', $lang);

But in Codeigniter4 if try to do this:

config('Config\\App')->defaultLocale = $lang;

The value of the global config don't change...

How can i do this? With the function config() i'm accessing to the global config or to a new instance of config?

Thx!