我有以下控制器,
class mycontroller extends CI_Controller
{
public function getvalue() {
$q= $this->db->select(array('value'))
->from('settting')
->get();
$data['data']= $q->result();
$this->load->view('myview',$data);
}
}
在我看来:
打印_r($数据);
给出这样的输出
Array ( [0] => stdClass Object ( [value] => wwwwwwwwwwww ) [1] => stdClass Object ( [value] => 5454546 ) [2] => stdClass Object ( [value] => 6868 ) [3] => stdClass Object ( [value] => 9898 ) [4] => stdClass Object ( [value] => 7878 ) [5] => stdClass Object ( [value] => 212 ) [6] => stdClass Object ( [value] => 87878 ) [7] => stdClass Object ( [value] => 8989 ) [8] => stdClass Object ( [value] => 212 ) )
我正在尝试将每个单个值存储在变量中
当我使用时,
foreach($data as $row)
{
echo $row->value;
}
它给了我所有的价值,但我需要将每个值保存在变量中。
我该怎么做,像这样,
$var1='wwwwwwwwwwww'; // [0 ] array value
$var2='5454546'; // [1] array value