我使用codeigniter的数据库类从我的数据库返回数据,无论如何我可以将它放入同一个数组中,而无需在循环完成后执行额外的array_merge逻辑?
foreach ($saved_forms[0] as $key => $value) {
$this->db->select('form_text');
$this->db->from('form_labels');
$this->db->where('form_label', $key );
$query = $this->db->get();
$form_names = $query->result_array();
$form_titles[] = $form_names;
}
结果数组
[4] => Array
(
[0] => Array
(
[form_text] => Participant Name
)
)
[5] => Array
(
[0] => Array
(
[form_text] => Date of Birth
)
)
我想要的是 :
[0] => Array
(
[form_text] => Participant Name
[form_text] => Date of Birth
)