我在Codeigniter中使用查詢來返回屬於用戶的所有行的ID。codeigniter flatten查詢結果數組
$this->db->select('id');
$this->db->where('user_id', 99);
$query = $this->db->get('my_table');
return $query->result_array();
這將返回
Array ([0] => Array ([id] => 8) [1] => Array ([id] => 7) [2] => Array ([id] => 6))
是否有可能返回一個平坦的陣列狀
Array ([0] => 8 [1] => 6 [2] => 7)
?
謝謝!我希望codeignter具有內置函數。 – CyberJunkie
將函數的結果存儲在變量中而不是每個循環調用函數都不是更好嗎? – user2019515