CodeIgniter - 创建新页面,获取404消息

时间:2014-09-23 16:22:59

标签: php codeigniter

我正在尝试创建一个新页面,该页面将显示一个表单,供他们输入组的名称。然后它将创建组并将其作为成员添加到组中。我有一个类似的注册,我已经复制并更改以满足此需求,但当我尝试访问它时,它给我一条404消息。

我正在访问控制器(groups.php):

<?php

class Login extends CI_Controller {

function index() {
    $this->load->view('includes/header');
    $this->load->view('group_view');
    $this->load->view('includes/footer');

    $this->createGroup();
}
function createGroup() {
    $this->load->library('form_validation');

    // validation rules
    $this->form_validation->set_rules('name', 'Name', 'trim|required');

    if ($this->form_validation->run() == FALSE) { //didnt validate

        $this->load->view('includes/header');
        $this->load->view('group_view');
        $this->load->view('includes/footer');
    } else {
        $this->load->model('model_groups');

        if($query = $this->model_groups->createGroup()) {

            //$data['account_created'] = 'Your account has been created.<br/><br/>You may now sign in.';

            $this->load->view('includes/header');
            $this->load->view('home_view');
            $this->load->view('includes/footer');
        } else {
            $this->load->view('includes/header');
            $this->load->view('group_view');
            $this->load->view('includes/footer');
        }
    } 

}
}
?>

我可以发布模型并在必要时查看,但我很确定问题出在控制器中,因为我正在尝试加载。请尽快告诉我我的问题是什么!多谢你们!

1 个答案:

答案 0 :(得分:1)

您应将班级名称Login更改为Group