The thinkphp of association model in the _php tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.