Class User{
public $id;
public $username;
public $password;
public $email;
public $steam;
public $donator;
public $active;
public function __construct($username, $email, $password, $id, $active, $donator, $steam){
$this->id = $id;
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->steam = $steam;
$this->donator = $donator;
$this->active = $active;
}}
is my class (simplified)
the following is my code:
$_SESSION['loggedIn'] = $user;
$user is a class instance of User
now this is what print_r($_SESSION['loggedIn']) shows me:
__PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => User
[id] => 22
[username] => xxxx
[password] => xxxx
[email] => xxxx
[steam] => 1234567
[donator] => 0
[active] => 1
)
in which xxxx are values that are correct.
but when i try to retrieve data from my session. like so: "$_SESSION['loggedIn']->username" it returns a null value to me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…