How use controller property after requests |
Hello,
How we can endure a state of a controller property after a request in CodeIgniter version 4. For example, imagine that $a is a complex object: / the controller complains that the variable $a must not be accessed before initialization Code: class Example extends BaseController Some other languages we have something to sustain the state of those variable. What we have on CodeIgniter? Are there some helper to import to do that for us? Thanks in advance.
I found the solution using sessions.
I can add $this->session = \Config\Services::session(); into BaseController Then, in the end of every method on my controller, I can save the state of $a into the session and in the begin I can get that state and assign into the controller property. |
Welcome Guest, Not a member yet? Register Sign In |