$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然后用户重定向测试控制器,但两个登录用户重定向测试控制器
答案 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