When beginners thinkphp, the association model in thinkphp has a simple error point, now for example:
Tables to be needed: Id_elite_major and Id_elite_student
Examples of the code are:
Copy the Code code as follows: Class Elitemajormodel extends relationmodel{
Protected $_link=array (
' Elitestudent ' =>array (
' Mapping_type ' =>has_many,//Easy to mistake: here in Has_many often add ' easy to write ' Has_many ', resulting in an error.
' Class_name ' = ' elitestudent ',
' Foreign_key ' = ' mid ',
' Mapping_name ' = ' studentslist ',
),
);
}
http://www.bkjia.com/PHPjc/825317.html www.bkjia.com true http://www.bkjia.com/PHPjc/825317.html techarticle Beginner thinkphp, thinkphp in the correlation model has a prone point, now examples are as follows: The table to be needed: Id_elite_major and Id_elite_student code examples are as follows: Copy code code as follows ...