Codeigniter中的数组到字符串转换错误.result_array()和array_unique()


Array to String conversion error in Codeigniter. result_array() and array_unique()

我只是想把查询中的结果数组(只有一列)变成一个唯一的数组,这样它就不会有重复的元素。

我不知道还能做什么,我什么都试过了,我做错了什么?

型号:

public function get_info()
    {
        $this->db->select('column');
        $this->db->from('table');
        $query=$this->db->get()->result_array();
        $out=array_unique($query);
        return $out;
    }

控制器:

public function index()
{
    $this->load->model('the_model');
    $data['stuff']=$this->the_model->get_info();
    $this->load->view('the_view',$data);
}

视图:

       <?php 
          foreach($stuff as $i)
         {
          echo "$i['column']}";
         }
        ?>

我得到的错误是:

A PHP Error was encountered 
Severity: Notice 
Message: Array to string conversion 
Filename: models/the_model.php

在查询中添加一个DISTINCT,这样结果就不会有重复的值。

public function get_info()
{
    $this->db->select('column');
    $this->db->distinct();
    $this->db->from('table');
    $query=$this->db->get()->result_array();
    $out=array_unique($query);
    return $out;
}