使用Codeigniter在注销功能(Ion Auth)上出错404

时间:2017-04-26 10:08:45

标签: php codeigniter ion-auth

调用此函数将我重定向到登录网页时抛出'404错误:找不到您请求的页面'。我遵循了我为另一个应用程序执行的相同步骤,它工作正常。任何想法?

链接

<li>
                            <a href="<?= base_url('auth/logout') ?>">Salir</a>
                        </li>

Ion Auth功能

// log the user out
public function logout() {
    $this->data['title'] = "Logout";

    // log the user out
    $logout = $this->ion_auth->logout();

    // redirect them to the login page
    $this->session->set_flashdata('message', $this->ion_auth->messages());
    redirect('auth/login', 'refresh');
}

BASE_URL

$config['base_url'] = 'http://localhost/herba/';

2 个答案:

答案 0 :(得分:1)

更改此

public function logout() {
    $this->data['title'] = "Logout";

    // log the user out
    $logout = $this->ion_auth->logout();

    // redirect them to the login page
    $this->session->set_flashdata('message', $this->ion_auth->messages());
    redirect(base_url('auth/login'), 'refresh');
}

请确认 http://localhost/herba/auth/login存在

同时查看index.php

http://localhost/herba/index.php/auth/login

答案 1 :(得分:0)

您的apache设置中是否为此项目启用了mod_rewrite和allow_override?