在codeigniter中爆炸功能

时间:2017-10-07 04:12:59

标签: php codeigniter

我是编程的新手,我在使用爆炸功能时遇到问题,即在我将值分解并将这些值传递给模型以从db中检索记录后,只显示爆炸数据中的最后一个值。 爆炸后我将数据驱动为(test,test1,test2)数据就像(testtest1test2)这里我将这些值传递给模型,从一个字段名称等于爆炸值的表中获取记录。我不会&#39我知道怎么解释这个请原谅我。

public function location($id) {
    $query = $this->gt_pav_model->select($id);
    $data['selectdata'] = $query->result();

    foreach( $data['selectdata'] as $s) {
        $explode = $s->package_id; // this is to get imploded data from db
    }

    $t = explode(",", $explode); 

    foreach( $t as $tt) {
        $query = $this->gt_pav_model->select_pa($tt);
        $data['dataa'] = $query->result();
        $this->load->view('pav/pavdetails',$data);  
    }
}

1 个答案:

答案 0 :(得分:0)

    const type = {
      link: 'red',
      text: function() {
        return `${this.link} f2`
      }
    }

您可以在视图页面public function location($id) { $final_result = array(); $result= $this->gt_pav_model->select($id)->result(); foreach( $result as $key=> $re) { $explode = $re->package_id; $t = explode(",", $explode); $param = $t[1]; $datas = $this->gt_pav_model->select_pa($param)->result(); $final_result[$key] => $datas; } $this->load->view('pav/pavdetails',array('datas'=>$final_result)); }

中打印结果