Thinkphp中表关联HAS_ONE和BELONGS_TO的区别

HAS_ONE(或HAS_MANY):外键在子关联对象中
例子:
父关联对象表:
product_id
product_name
子关联对象表:
image_id
image_name
product_id
外键是:product_id

BELONGS_TO:外键在你父联对象中
父关联对象表:
product_id
class_id
product_name
子关联对象表:
class_id
class_name
外键是:class_id

affiliate_link
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Thinkphp中表关联HAS_ONE和BELONGS_TO的区别”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>