【发布时间】:2017-09-14 07:56:57
【问题描述】:
晚上好,老师。我是代码点火器框架的新手。我想问一下如何使用代码点火器调用特定数据。我下面的代码打算从我的数据库中调用图片的名称。
这是我的模特
function profile_picture(){
$username = $this->session->userdata('name');
$this->db->select('pict_name');
$this->db->from('picture');
$this->db->where('username="$username"');
$this->db->limit(1);
$query = $this->db->get();
return $query;
}
这是我的控制器
public function v_profile(){
$data['ppicture'] = $this->m_profile->profile_picture()->result();
$data['profile'] = "profile";
$this->load->view('header',$data);
$this->load->view('profile',$data);
$this->load->view('footer',$data);
}
这是我的看法
<img src="<?php echo base_url()."assets/img/".$ppicture; ?>" class="img-rounded" >
上面的代码显示错误:数组到字符串的转换。我该如何解决?谢谢
【问题讨论】:
标签: php codeigniter