使用 Codeigniter 的注销功能 (Ion Auth) 出现错误 404
Error 404 on logout function (Ion Auth) using Codeigniter
调用此函数将我重定向到登录网页时抛出“404 错误:找不到您请求的页面”。我遵循了与另一个应用程序相同的步骤,并且运行良好。有什么想法吗?
Link
<li>
<a href="<?= base_url('auth/logout') ?>">Salir</a>
</li>
离子授权功能
// 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/';
改变这个
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
您是否在您的 Apache 设置中为此项目启用了 mod_rewrite 和 allow_override?
调用此函数将我重定向到登录网页时抛出“404 错误:找不到您请求的页面”。我遵循了与另一个应用程序相同的步骤,并且运行良好。有什么想法吗?
Link
<li>
<a href="<?= base_url('auth/logout') ?>">Salir</a>
</li>
离子授权功能
// 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/';
改变这个
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
您是否在您的 Apache 设置中为此项目启用了 mod_rewrite 和 allow_override?