繼續從這個主題link textCodeigniter會話的數組操作
嗨,大家好。我正在使用codeigniter並希望將數據存儲在會話中。我有這樣的陣列
array(4) {
[0]=> array(2) { ["DESC"]=> string(1) "A" ["SUBFUNCTION_ID"]=> string(3) "904" }
[1]=> array(2) { ["DESC"]=> string(1) "B" ["SUBFUNCTION_ID"]=> string(3) "903" }
[2]=> array(2) { ["DESC"]=> string(1) "C" ["SUBFUNCTION_ID"]=> string(3) "902" }
[3]=> array(2) { ["DESC"]=> string(1) "D" ["SUBFUNCTION_ID"]=> string(3) "901" }
}
這是存儲會話數據
$data = array(
'username' => $this->input->post('username'),
'userid' => $query->USER_ID,
'role' => $query->ROLE_ID,
'is_logged_in' => true
)的陣列;
我該如何操作第一個數組,然後將數據追加到第二個數組中?我希望它變成這樣的東西
$data = array(
'username' => $this->input->post('username'),
'userid' => $query->USER_ID,
'role' => $query->ROLE_ID,
'is_logged_in' => true,
'A' => 904,
'B' => 903,
'C' => 902,
'D' => 901
);
在此先感謝