Set data as tempdata, we have to use mark_as_temp() function. This function takes two argument items first argument is a tempdata second one is a expiration time.
You can also pass an array to store multiple data. All the items value stored below will be expired after 300 seconds.
You can also set different expiration time for each item
We can retrieve the tempdata using tempdata() function.
Tempdata is removed automatically after its expiration time but if you want to remove tempdata before that, then you can do as shown below using the unset_tempdata() function, which takes one argument of the item to be removed.
Trending Tutorials