Ojects and sessions
| From: | Greg Sidelinger | Date: | Mon, 26 Nov 2001 00:35:07 +0000 |
| Subject: | Ojects and sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75688@lists.php.net to get a copy of this message | ||
I'm trying to store some classes that I created in session variables. I
want to test for the object at the beginning of each page and if it does
not exist I want to create it.
I have the class definitions in a separate file that is included before
session_start()
But when I try to access the object I get an error.
Here is what I am trying right now. This is from an example in the
Docs.
<?
include_once('class.inc');
session_start();
if(session_is_registered("a"))
{
$a = &$HTTP_SESSION_VARS["a"];
}
else
{
$a = new cart();
session_register("a");
$HTTP_SESSION_VARS["a"] = &$a;
}
?>
Can some one please point me in the right direction on how to get
objects stored in my session vars.
Greg Sidelinger