ThinkPHP:視圖模型的使用

摘要
視圖模型的做用是:進行多表查詢。ui

定義:
this

使用視圖模型注意的幾個點:spa

1)表名的寫法:study_room ===>StudyRoom;select

2)給字段名器別名:'chn'=>'course_name'。將字段名chn起別名爲course_name;im

3)表與表間的關聯邏輯:'_on'=>'StudyRoom.uid=user.uid'查詢

 

使用:img

1)在非本類中使用:co

D("StudyRoomView") 或 D("Study/StudyRoomView")模型

2)在本類中使用:

$this->。例:$this->where($where)->select();  

相關文章
相關標籤/搜索