Setting and Getting Session and Flashdata |
Can anybody guide me how to set and retrieve session and flashdata?
I initialized session base controller and when I try to set and get on User controller, I am getting error saying "ErrorExceptoin": undefined variable $session when using this snippet below PHP Code: $session->set('user', 'someone');
09-26-2019, 02:14 AM
(This post was last modified: 09-26-2019, 02:20 AM by Digital_Wolf. Edit Reason: added link )
full simple example for CI4:
PHP Code: <?php Official guide to using the session library: User_Guide I would change this world, but God doesn't give me the source.
(09-26-2019, 02:14 AM)Digital_Wolf Wrote: full simple example for CI4:
(09-26-2019, 12:16 AM)msjagan Wrote: Can anybody guide me how to set and retrieve session and flashdata?I was also facing same problem. I got my answer, thaks a lot
CI4, different with CI3.
learn about filter. https://github.com/codeigniter4/CodeIgni...ilters.rst use BaseConttoller for autoload libraries, helper etc.
Yes CI4 is way different than CI3.
learning the changes was made on CI4 by applying in sample project. Also found simple way to set and get session and flashdata. I will share my code with sample project which I am working on once its done.
(09-26-2019, 02:53 AM)sktiwari19 Wrote:Hello Bro, i have joined this community to improve my skills not for spam(09-26-2019, 12:16 AM)msjagan Wrote: Can anybody guide me how to set and retrieve session and flashdata?I was also facing same problem. I got my answer, thaks a lot
The error appears because you are using CI3, I gave an example for CI4. CI4 has been rewritten and therefore they are incompatible.
If you still have errors, then describe them here, but rather best to provide logs from the folder /writable/logs/ or /writable/debug/ if they are available. I would change this world, but God doesn't give me the source.
|
Welcome Guest, Not a member yet? Register Sign In |