|
Posted by Rik on 10/10/06 23:42
djcredo@gmail.com wrote:
> Hi all,
>
> Suppose I have a "User" object intialized with user details I've
> obtained from a database. When the user navigates to another section
> of the site, I want that object to be available on that page.
>
> Which is the best way to pass that object?
>
> a) Through the Session variable
> b) By keeping the variable in a seperate file, and include_once() that
> file on every page
> c) Some form of serialization
> d) None of the above lol
Euhm, if it's an object, a through c :-)
1. Use a session to store it (which will store it in a file in a folder,
including will be done by the session handler).
2. Objects have to be serialized when stored in a session.
Be sure to include the appropriate class on every page to be able to use
your object, if you've got PHP5 autoloading is a handy feature.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|