Can i pass a object with session_register ().
I am trying and a error ocours, like this:
Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition teste of the object you are trying to operate on was loaded before the session was started in /var/lib/httpd/htdocs/index_1.php on line 5
I have two files:
#################################
//index.php
<?
session_start ();
class teste {
var $teste1;
function set_teste () {
$teste1 = "Teste";
}
function get_teste () {
return $teste1;
}
}
$teste_inst = new teste;
session_register (teste_inst);
?>
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<head>
<title>Title here!</title>
</head>
<body>
<a href = "index_1.php">Teste</a>
</body>
//#################################
//index_1.php
<?
session_start ();
print $teste_inst->get_teste ();
?>