所以我有一个
的会话变量 $info = $this->session->userdata('userInfo');
它有一个这个
的数据 [user] => stdClass Object
(
[student_id] => 201410679
[firstname] => NEHEMIAH
[midname] => ONGTANGCO
[lastname] => BALUYUT
[username] => nobaluyut
[password] => nobaluyut
[email] => adre@fit.edu.ph
[student_department] => CE
[image_path] => assets/img/profiles/profile.jpg
[student_is_blocked] => 1
[offering_id] => 1
)
[logged_in] => 1
[identifier] => student
[active_enrollment] => 1
如何在不覆盖整个会话变量的情况下更新[user] [student_is_blocked]?
答案 0 :(得分:2)
如果'userInfo'是会话变量,并且其中包含数组和变量。然后
$info = $this->session->userdata('userInfo');
$info['user']->student_is_blocked= "Any Value";
$this->session->set_userdata('userInfo', $info);