how to get single value from array in codeigniter

前端 未结 2 1847
我寻月下人不归
我寻月下人不归 2021-01-23 06:44

I stored some data to an array using this code

$this->data[\'result\']    =   $this->mymodel->search($keyword);

when I print my result

2条回答
  •  悲哀的现实
    2021-01-23 06:59

    Try this:

     $pro_id = [];
    
     foreach($this->data['result'] as $key => $val){
        $pro_id[] = $val->product_id;
     }
    
     print_r($pro_id);
    

提交回复
热议问题