如何获得我所属的群组名称?
我可以获得这些信息:
$user = Phpfox::getService('user')->get($username, false)
;
[user_group_id] => 6 [title] => user_group_title_3749ea904585437bb7e01c7e1571e162
答案 0 :(得分:0)
您可以使用此查询:
SELECT ug.title FROM phpfox_user as u
join phpfox_user_group as ug on ug.user_group_id = u.user_group_id
WHERE u.user_id=1
然后将结果放在_p函数
中示例:
$sUserTitle = Phpfox::getLib('database')->select('ug.title')
->from(':user', 'u')
->join(':user_group', 'ug', 'ug.user_group_id = u.user_group_id')
->where('u.user_id=' . Phpfox::getUserId())
->execute('getSlaveField');
echo _p($sUserTitle)