1、关联模型 文件名是否一定要命名UserRelationModel.class.php?
2、在UserRelationModel.class.php文件中写的:
public function reg(){
//这里是否要写表的字段和数据表的字段?如
//$data = array ( 'username' =>$username);
//这里还需要写D('UserRelation')来实例化吗??
if($this->create($data)){
$id = $this->relation(true)->add();
}
}
这里这么写无法写入数据库???
最佳答案