ThinkPHP视图查询详解(2)

array(1) { [0] => array(5) { ["id"] => string(1) "1" ["name"] => string(7) "zzguo28" ["email"] => string(17) "zzguo28@163.com" ["mobile"] => string(11) "12345678901" ["dept"] => string(9) "销售部" } }

并可以看到使用的sql如下

"SELECT u.id AS id,u.name AS name,ui.email AS email,ui.mobile AS mobile,Dept.name AS dept FROM think_user u LEFT JOIN think_user_info ui ON ui.user_id=u.id JOIN think_dept Dept ON u.dept_id=Dept.id WHERE ( u.id = 1 ) LIMIT 1 "

视图模型在查询上和普通单表并没有多大分别,可以使用我们所熟悉的各种连贯操作,例如order,limit等等。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2a83225d0229b631de0fa2812949085c.html