【发布时间】:2013-05-21 22:27:00
【问题描述】:
我是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();
}
}
}
“authen”方法在其最后条件下无法正常工作。页面不重定向到控制器。
有人可以帮忙吗? 谢谢
【问题讨论】:
标签: codeigniter