0

我想将我的查询结果显示到我的 sendmail 控制器中,如下所示:

控制器

function contact()
{
    $data['email'] = $this->Pgallery_model->get_Email();
            $config['protocol'] = 'sendmail';

            $this->email->initialize($config);

            $this->email->to(/*here query result*/);

            $this->email->send();               
            $this->load->view('contact_success', $data);
    }

模型

function get_Email()
{
    $query = $this->db->query('select email from setup');
    return $query->result();
}

如何查询到我的投递邮件?谢谢你

4

1 回答 1

0

要获得查询结果,您应该使用:

$result  = $this->db->result();

这将为您提供一个对象,然后您必须执行以下操作:

echo $result->email;

我想向您指出,使用驼峰和下划线大多是不好的做法。

get_Email() should either be getEmail() or get_email()
于 2012-07-09T11:46:10.237 回答