
【代码】:
public function getUserRoles($userName)
{
$table = M('user');
$where['username'] = $userName;
//self::__construct();
//Call to a member function join() on a non-ob
$data = $Model
->join('smatrix_user ON smatrix_user_role.userid = smatrix_user.id')//指定的数据表必须是全称
->join('smatrix_role ON smatrix_user_role.roleid = smatrix_role.id')
->field('smatrix_user.*')
->select();
return $data;
}
最佳答案