CI中的数据返回
$this->db->get('table')这个方法,返回的数据没有我想要的,打印出来是这样的:object(CI_DB_mysql_result)#12 (7) {
["conn_id"]=>
resource(28) of type (mysql link persistent)
["result_id"]=>
resource(29) of type (mysql result)
["result_array"]=>
array(0) {
}
["result_object"]=>
array(0) {
}
["current_row"]=>
int(0)
["num_rows"]=>
int(3)
["row_data"]=>
NULL
}
我想得到的键值应该是 id和name
这个是怎么回事呢? 看 http://codeigniter.org.cn/user_guide/database/results.html $query = $this->db->get('table');
foreach ($query->result() as $row)
{
echo $row->id;
echo $row->name;
} 数组的返回值不是那么得到的
页:
[1]