CodeIgniter Forums
Change dynamically setting variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Change dynamically setting variables (/thread-79000.html)



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!