【问题标题】:CodeIgniter - redirect function not working properlyCodeIgniter - 重定向功能无法正常工作
【发布时间】:2017-03-16 18:26:16
【问题描述】:

我有一个身份验证功能(代码添加在下面),但是当提交正确的凭据时,重定向功能无法正常工作。 Firefox 显示“连接已重置”,Chrome 显示“未收到数据”。

请帮忙。

"redirect(base_url() . "index.php/masteradmin/Dashboard");" 行是没有重定向的那个。

public function AuthenticateUser() {
    $this->load->helper('url');
    $email = $this->input->post("email");
    $password = $this->input->post("password");
    if ($email && $password) {
        $status = $this->mastermodal->ValidateSuperAdmin();
        if (is_array($status)) {
            $this->index($status['Message']);
        } else if ($status) {
            if ($this->session->userdata('table') == 'master') {
                redirect(base_url() . "index.php/masteradmin/Dashboard");
            }
        } else {
            $loginerrormsg = "invalid email or password";
            $this->index($loginerrormsg);
        }
    } else {
        redirect(base_url() . "index.php/masteradmin");
    }
}

【问题讨论】:

  • 你能添加你的模态代码
  • 配置中的base URL是否以http:\` or https:\`开头?如果您没有更改它,那么它不会将其视为新请求,您最终会出现重定向循环
  • 把这个redirect(base_url() . "index.php/masteradmin");改成redirect('masteradmin/Dashboard');
  • 你的模态在哪里?

标签: php codeigniter


【解决方案1】:

你可以试试流动代码

    redirect(base_url().'index.php/masteradmin',refresh)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    • 2017-09-23
    • 2017-09-23
    • 2015-08-09
    • 2014-07-01
    相关资源
    最近更新 更多