Objects and sessions
| From: | Greg Sidelinger | Date: | Mon, 26 Nov 2001 18:57:15 +0000 |
| Subject: | Objects and sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75729@lists.php.net to get a copy of this message | ||
Can someone tell me how to store a class in a session var. I want to
test to see if it has been defined and if not create it. I'm having
problems with it right now.
This is what I'm trying currently
<?
Class a
{
var $temp;
function a()
{
$this->temp=1;
}
}
session_start();
if ( !isset( $c )
{
$c = new a();
session_register("a");
}
?>
later on I get errors about the class functions being undefined. Can
anyone please point me in the right direction on how to register my
objects as session vars.