how to get single value from array in codeigniter

前端 未结 2 1849
我寻月下人不归
我寻月下人不归 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:46

    If your model returns only one record, you can use this shortcut:

    $pro_id = $this->data['result'][0]->product_id;

提交回复
热议问题