$news=D('news')->relation(true)->select();
//p($news);
//die;
$this->display();
}
模型:<?php
Class NewsRelationModel extends RelationModel{
Protected $tableName='news';
Protected $_li
'new_attr'=>array(
'mapping_type'=>BLONGS_TO,
'foreign_key'=>'cid',
'mapping_fields'=>'name'
)
);
}
?>
主表名:news,另一个表名:new_attr,
出现错误:
Model:relation您所请求的方法不存在!
错误位置
FILE: D:\apache\htdocs\php5\nowstore\ThinkPHP\Lib\Core\Model.class.php LINE: 253
最佳答案