Storing an object in $_SESSION

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tekdek
Forum Newbie
Posts: 3
Joined: Mon Nov 17, 2003 11:22 pm

Storing an object in $_SESSION

Post by tekdek »

can this be done? does not seem to be working for me
if not is there a way around it?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

It can be done. Just include your class definition in each of your pages:

Code: Select all

include 'myclass.php';
  session_start();
  $some_object=$_SESSION['some_object'];
  $some_object->do_something();
tekdek
Forum Newbie
Posts: 3
Joined: Mon Nov 17, 2003 11:22 pm

Post by tekdek »

thanks for the help!... fixed
Post Reply