Temp data that must be destroyed at end of lifecycle |
Hello everybody,
I want to create some data (for example, the object that represents the current user) that must be deleted at the end of the HTTP request, i.e. at the end of the CI lifecycle. How can I do ? Session->flashdata : the data is destroyed at the next request Session->tempdata : the data is destroyed after a specified time Thanks in advance Vincent
For v3 using Hooks is probably the way to go. Specifically for your needs, the post_controller hook.
It's pretty well explained in the documentation, but let us know if you have implementation questions.
(06-26-2020, 09:15 AM)vincent78 Wrote: @Dave friend: Thanks for your answer Yes, that would work. Any data that is held only in (non-persistent) memory like a class instance object will automatically be destroyed when script execution ends. I assumed from the original question that you were using something that was potentially persistent like session data or a temp database table. |
Welcome Guest, Not a member yet? Register Sign In |