我使用此代码($rval['arr']
)将一些数据存储到数组中:
$id = $this->input->get("id");
$rval['arr'] = $this->General_model->details($id);
当我使用print_r($rval['arr']);
打印结果时,它显示如下:
Array ( [0] => Array ( [id] => 54 [name] => Rajib [address] => DumDum [mobile] => 9865321245 [doj] => 21-2-2010 [fare] => 1245 [img_name] => Penguins.jpg ) )
现在我想将地址值存储到add
之类的变量中。我怎么能这样做?
答案 0 :(得分:0)
答案 1 :(得分:0)
您也可以在foreach()
循环中执行此操作:
foreach($rval['arr'] as $array){
echo $array['name'];
echo $array['address'];
echo $array['mobile'];
}