codeigniter - Codeigniter ion auth login make 多个用户 if 语句错误
问题描述
我在 System CI 中创建了更多用户,我尝试让 Auth_controller.php 使用 if 语句处理它......当我们使用 if 语句登录并尝试登录用户“gudang”时,它只是获取$this->load->view('sales/header');
$this->load->view('admin/dashboard');
销售语句,这个语句“gudang”无法加载这种观点
public function index()
{ if (!$this->ion_auth->logged_in()){
redirect('auth/login', 'refresh');
}
elseif ($this->ion_auth->is_admin()){
//return show_error('You must be an administrator to view this page.');
// set the flash data error message if there is one
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
$this->data['users'] = $this->ion_auth->users()->result();
foreach ($this->data['users'] as $k => $user)
{
$this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
}
$this->_render_page('admin/lte/header', $this->data);
$this->_render_page('admin/dashboard', $this->data);
// $this->_render_page('admin/lte/footer', $this->data);
}elseif ($this->ion_auth->get_users_groups($user->id)==='Sales'){
$this->load->view('sales/header');
$this->load->view('admin/dashboard');
}elseif ($this->data['users'] = $this->ion_auth->users('gudang')){
$this->load->view('gudang/header');
$this->load->view('admin/dashboard');
}else{
redirect('auth/login', 'refresh');
}
}
解决方案
推荐阅读
- reinforcement-learning - 在 Python 3 上的 Open AI Gym 实现中声明编码
- c++ - 与 XTR-DH Crypto++ 的密钥协议
- nginx - Lua 脚本可以从站点可用/启用站点的配置中获取变量吗?
- anaconda - Jupyter 笔记本,在哪里?
- c# - UWP 如何通知进程终止?
- javascript - 设法在html页面中下载文件依赖项
- angular - rxjs/operators:找不到模块
- java - Java编写仅在编译时运行的代码?
- php - 从xml填充数组?PHP/XML
- javascript - 使用 fetch POST 数据后自动刷新