Home > Backend Development > PHP Tutorial > ThinkPHP中的关联模型注意点_PHP

ThinkPHP中的关联模型注意点_PHP

WBOY
Release: 2016-06-01 11:51:06
Original
923 people have browsed it

ThinkPHP

初学ThinkPHP时,ThinkPHP中的关联模型有一处易错点,现举例如下:
需用到的表:id_elite_major和id_elite_student
代码举例如下:

复制代码 代码如下:class EliteMajorModel extends RelationModel{
protected $_link=array(
'EliteStudent'=>array(
'mapping_type'=>HAS_MANY,  //易错点: 此处在 HAS_MANY 时常会加上 '' 容易写成 'HAS_MANY',导致出错
'class_name'=>'EliteStudent',
'foreign_key'=>'mid',
'mapping_name'=>'studentslist',
),
);
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template