首先是定义ORM模型: class Model_District extends ORM{ protected $_table_name = 'sq_district'; protected $_db = 'default'; protected $_primary_key = 'd_id'; protected $_primary_val = 'd_id'; protected $_table_names_plural = FALSE; } 此处的主键和主键值我一直没弄明白它俩到底有什么区别,索性就设置成一个了 下面是我的Controller: public function action_index() { //结合上面的模型,这里选择的是d_id=1的单条数据,并且作为数组输出的 $district = ORM::factory ( 'district', 1 ); $ds = $district->find ()->as_array (); echo $ds ['d_name']; //多条数据用find_all()方法, $district = ORM::factory ( 'district' )->find ()->find_all (); //$ds = $district->where('d_id', '=', 2)->find_all(); 可以这样添加条件 //然后迭代输出 foreach ( $district as $d ) { echo $d->d_name; } } 添加数据: $dis = ORM::factory('district'); $dis->values(array('d_name'=>'绿园区'))->save();