要在Joomla 2.5.15中获取用户组ID,我按照
Joomla Documentation here中的文档进行操作
我的代码如下所示:
$user = JFactory::getUser(); echo "<p>Your group id is {$user->gid}.</p>";
试试这个:
$user = JFactory::getUser(); $groups = $user->get('groups'); foreach ($groups as $group) { echo '<p>Group = ' . $group . '</p>'; }