Salve, io ho questi stralcu di classi che utilizzo:
Codice PHP:
class Sessione{
public static function setSessionVar($name, $value=null){
$_SESSION[$name] = $value;
}
public static function checkSession($name){
return isset($_SESSION[$name]);
}
public static function getSessionVar($name){
if (isset($_SESSION[$name])) return $_SESSION[$name];
return false;
}
public static function getSessionVars(){
return $_SESSION;
}
}
e questo uno stralcio del suo utilizzo
Codice PHP:
if(Sessione::checkSession("messages")){
var_dump(Sessione::getSessionVar("messages"));
$message = new Message();
$message = Sessione::getSessionVar("messages");
echo($message->stampa());
}
.....
if($message->isMessage()){//se ci sono messaggi li salvo in una sessione
Sessione::setSessionVar("messages", $message);
}
il problema è che mi restituisce un errore appena recupero la sessione
Fatal error: main() [
function.main]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Message" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\Programmi\EasyPHP\www\iFood\gestione\install.ph p on line 17
ma il var_dump è corretto:
# messaggio sessioneobject(__PHP_Incomplete_Class)#1 (5) { ["__PHP_Incomplete_Class_Name"]=> string(7) "Message" ["count

rivate"]=> int(2) ["messE

rivate"]=> string(35) "Devi inserire una password
# " ["messW

rivate"]=> string(54) "Devi inserire un nome utente più lungo
" ["messC

rivate"]=> NULL }
come risolvo? ogni idea è ben accetta