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;

}