首页 文章

CodeIgniter Wamp:无法找到文件错误

提问于
浏览
0

我刚安装了Wamp服务器的全新安装,并将一个正在运行的CodeIgniter项目(我没有完成)复制到其中 . 我已经更改了config.php(base_url)和database.php(mysql凭据)中的设置,并确保数据库连接正常 .

我可以看到登录页面,但是当我登录时,它返回“无法找到文件错误”,我相信它需要在Wamp服务器上进行一些设置 . 根CI文件夹中没有.htaccess文件,应该有吗?什么可能出错的建议?

enter image description here

在controllers文件夹中有一个admin.php文件

<?php

class Admin extends CI_Controller
{
function __construct()
{
    parent::__construct();
    $this->lang->load($this->config->item('admin_language'), $this->config->item('admin_language'));
}

private $rules = array(
                    array(
                        'field'   => 'username',
                        'label'   => 'lang:username',
                        'rules'   => 'trim|required',
                    ),
                    array(
                        'field'   => 'password',
                        'label'   => 'lang:password',
                        'rules'   => 'trim|required|min_length[8]',
                    )
                );

function index()
{
    $this->load->library('form_validation');
    $redirect_to = $this->config->item('base_url') . 'index.php/admin/products/';
    if ($this->auth->logged_in() == FALSE)
    {
        $data['error'] = FALSE;
        $this->load->library('form_validation');
        $this->form_validation->set_rules($this->rules);
        $this->form_validation->set_error_delimiters('<p class="error">', '</p>');
        //echo "1";die;
        if ($this->form_validation->run() == FALSE)
        {
            //echo "if";die;
            $this->load->view('admin/login', $data);
        }
        else
        {
            //echo "el";die;
            $this->auth->login($this->input->post('username'), $this->input->post('password'), $redirect_to, 'index.php/admin/login');
        }
    }
    else
    {
        //echo "asdadad";die;
        redirect($redirect_to);
    }
}

function logout()
{
    $this->auth->logout($this->config->item('base_url') . 'index.php/admin');
}
}

?>

1 回答

  • 0

    请将您的功能名称索引更改为登录 .

    如果您使用的是函数名索引,那么url将是localhost / projectname / index.php / admin

    如果您将功能名称更改为登录,那么这将是我们的工作 .

相关问题