我是CodeIgniter
中的新成员。我遇到了问题。我的程序似乎合乎逻辑,但它不起作用!codeigniter:从另一种方法调用索引方法
我有一个控制器:User
class User extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('user_model');
}
public function index($slug = FALSE) {
$data['title'] = "User List";
if($slug === FALSE) {
$data['user'] = $this->user_model->get_user();
} else {
$data['user'] = $this->user_model->get_user($slug);
}
if (empty($data['user'])){
show_404();
}
$this->load->library('table');
$this->load->view('user_view', $data);
}
public function authen() {
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('phone', 'phone', 'required');
$this->form_validation->set_rules('password', 'password', 'required');
if ($this->form_validation->run() === FALSE) {
$this->load->view('login_form');
} else {
if($this->user_model->do_login()===TRUE) {
$this->index();
}
$this->authen();
}
}
}
的“认证介绍”方法不使用其最后条件正常工作。页面不重定向到控制器。
任何人都可以帮忙吗? 感谢
谢谢,它的工作原理。但为什么不$ this-> index()不起作用?事实上,几个谷歌网站这么说... –
尝试检查这一个:http://stackoverflow.com/questions/723883/redirect-with-codeigniter –