When you first learn ThinkPHP, there is an error-prone point in the association model in ThinkPHP. Here is an example:
The tables to be used: id_elite_major and id_elite_student
The code example is as follows:
Copy code The code is as follows:
class EliteMajorModel extends RelationModel{
protected $_link=array(
'EliteStudent'= >array(
'mapping_type'=>HAS_MANY, //Error-prone point: '' is often added to HAS_MANY here, which is easy to be written as 'HAS_MANY', resulting in errors
'class_name'=>'EliteStudent ',
'foreign_key'=>'mid',
'mapping_name'=>'studentslist',
),
);
}
http://www.bkjia.com/PHPjc/825317.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825317.htmlTechArticleWhen you first learn ThinkPHP, there is an error-prone point in the association model in ThinkPHP. Here is an example: Tables to be used :id_elite_major and id_elite_student code examples are as follows: Copy the code as follows...