![]() |
According to: https://codeigniter.com/user_guide/libra...sions.html
I should be able to initialize i BasicController: Code: $session = \Config\Services::session($config); and then use $session whenever i want, but if i am trying to use it in other controllers without problem, but i am getting: Undefined variable: session I can initialize: Code: $this->session = \Config\Services::session(); and then use in other controllers: $this->session->. It works fine, but i would preffer to use $session-> (for reasons). I need to initialize it somewhere else or something? Thread about my project that is using CodeIgniter:
It seems you need to learn PHP's variables and properties.
See https://www.php.net/manual/en/language.v...basics.php https://www.php.net/manual/en/language.v....scope.php https://www.php.net/manual/en/language.o...erties.php But the explanation in the PHP manual is not easy to understand.
Intiallize it in the BaseController then use the session helper $session()->
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(02-03-2022, 05:14 PM)kenjis Wrote: It seems you need to learn PHP's variables and properties. Sorry, but this is a typical answer that doesn't help anyone.
If a programmer can read and understand the PHP manual, it is the most precise resource.
It helps he/she a lot. |
Welcome Guest, Not a member yet? Register Sign In |