class newsModel extends RelationModel{
protected $_auto = array(
array('post_time','time',1,'function'),
);
protected $_link = array(
'newscolumn'=> array(
'mapping_type'=>HAS_MANY,
'mapping_name'=>'cid',
'foreigh_key'=>'cid',
'mapping_field'=>'name',
'as_fields'=>'col',
),
);
} public function manage(){
$news = D('news');
$news = $news->Relation(ture)->select();
print_r($news);
}我news表里面有cid字段想关联newscolumn表里面的cid(是主键),上面代码不能成功,只有news表的信息出来了。 最佳答案