|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Variables of sessions and classes I explain my problem: In a method call, when a user login, it create an object that I stored in a session variable in the future, like this: $user = new User($id, $name, $email, $password, $level, $lang); $_SESSION ['User'] = $user; Then, in another page, I get my item in a variable: $user = $_SESSION ['user']; And when I do: echo $user->id; I get the following message: Notice: main () [function.main]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "User" 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 I do not understand why it does not. Someone has an idea? |
#2
| |||
| |||
Re: Variables of sessions and classes Try any (code not tested): PHP Code: PHP Code: |
#3
| |||
| |||
Re: Variables of sessions and classes It works, thank you very much! You could tell me what these functions stp? |
#4
| |||
| |||
Re: Variables of sessions and classes The sessions can contain resources (like connecting to a comic) or instances of objects. That's why it is so. For objects, the solution is to serialize object: it is the solution given by fellah. As against this solution does not for the resources. |
![]() |
|
Tags: class, php, session, variable |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How sessions are uniquely identified in ASP.net | jEEMOOT | Software Development | 3 | 12-01-2011 07:51 PM |
Help!! Spring and Hibernate sessions | Fragant | Software Development | 6 | 15-09-2010 09:40 PM |
Sessions with Java Servlets | Sheenas | Software Development | 5 | 15-02-2010 08:15 PM |
What is PHP sessions and how they function | Zavier | Software Development | 5 | 23-01-2010 02:30 AM |
How to set sessions for checkboxes | RogerFielden | Software Development | 3 | 15-04-2009 02:07 PM |