ThinkPHP join() table()方法的使用,多表查询
ThinkPHP模型类比较常用的两个方法,table() join()
table
1
|
$list = M()->table( 'user1 a, user2 b' )->where( 'a.id = b.id' )->field( 'a.name,b.sex' )->order( 'a.id desc' )->select(); |
join
1
2
|
$pre = C( 'DB_PREFIX' ); M( "user u" )->join( "{$per}user_info x ON x.uid = u.id" )->where( "u.id = $uid" )->find(); |
帅的无语!