标签:
$model为实例化模型对象;
1.查询一条数据
//$id 主键值
$model->get_info($id);
2.查询多条数据 并分页
$page = $this->_get_page(); $datas = $model->find(array( ‘conditions‘ => ‘1=1‘ . $conditions, ‘limit‘ => $page[‘limit‘], ‘count‘ => true, ‘order‘ => ‘sort_order‘, )); $this->_format_page($page); $this->assign(‘page_info‘, $page);
3.统计数据条数
$count = $model->getCount();
标签:
原文地址:http://www.cnblogs.com/swinm/p/4643407.html