离子auth组登录

时间:2016-08-22 07:20:07

标签: php codeigniter ion-auth

$groupadmin ='1';
if ($this->ion_auth->in_group($groupadmin))
{
    $this->session->set_flashdata('message', 'You must be part of the group 1 to view this page');
    redirect('dashboard');
}else
{
    $this->session->set_flashdata('message', 'You must be part of the group 2 to view this page');
    redirect('test');
} 

如果group id = 1,那么用户重定向仪表板和组id = 2然后用户重定向测试控制器,但两个登录用户重定向测试控制器

1 个答案:

答案 0 :(得分:2)

您只能在interger中更改代码groupadmin变量。

$groupadmin = 1;
if ($this->ion_auth->in_group($groupadmin))
{
   $this->session->set_flashdata('message', 'You must be part of the group 1 to view this page');
   redirect('dashboard');
} else {
   $this->session->set_flashdata('message', 'You must be part of the group 2 to view this page');
   redirect('test');
}

您可以访问此网址以供参考http://benedmunds.com/ion_auth/#in_group

相关问题