我有一个数组
$user = array([0]=>1 [1]=>2 [2]=>3)
其中包含某些用户的 id。我需要从数据库中获取这些用户的国家。
foreach($userid as $user){
$this->db->select('country');
$this->db->where('user_id',$user);
$this->db->from('company');
$usercountry = $this->db->get();
$count = $usercountry->row();
$country = $count->country;
}
假设 user1 有国家 ES,user2 有 IN,user3 有 US,user4 有 UK。那么如果数组包含 1,2,3。然后我需要得到国家 ES,IN,US。