You can use sessions to store complex data types such as objects and arrays simply by treating them as standard variables, as this code shows:
You can also use the serialize() and unserialize() functions to explicitly convert to and from a string. If you do not call serialize() yourself, PHP will do it for you when the session data is written to disk – many do rely on this, but I would say it’s best to be explicit and serialize() data yourself.
No comments:
Post a Comment