2
$new_array_user_id = array('user_id' => $this->Session->read('UserAuth.User.id'));
輸出:合併數組在CakePHP
Array
(
[user_id] => 19
)
這裏previos陣列碼:
$prevSessionData = $this->Session->read('form.data');
Array
(
[Project] => Array
(
[first_name] => vikas
[last_name] => tyagi
)
)
合併數組:
$currentSessionDatas = Hash::merge((array) $new_array_user_id, $prevSessionData);
Array
(
[user_id] => 19
[Project] => Array
(
[first_name] => vikas
[last_name] => tyagi
)
)
需要輸出喜歡的是:
Array
(
[Project] => Array
(
[user_id] => 19
[first_name] => vikas
[last_name] => tyagi
)
)