在Codeigniter 3中提交表单后,localhost重定向到127.0.0.1

Jer*_*lle 1 codeigniter

我的代码有问题。我的代码中有一个看起来像这样的表格:

<?php echo form_open('users/auth/login', array('class' => 'form floating-label')); ?>   
    <div class="form-group">
        <input type="text" class="form-control" id="username" name="username" />
        <label for="username">Username</label>
    </div>
    <div class="form-group">
        <input type="password" class="form-control" id="password" name="password" />
        <label for="password">Password</label>
        <p class="help-block"><a href="#">Forgotten?</a></p>
    </div>
    <br/>
    <div class="row">
        <div class="col-xs-12 text-right">
            <?php echo $this->session->flashdata('note'); ?>
            <button class="btn btn-primary btn-raised btn-ink" type="submit">Login Account</button>
        </div>
    </div>
<?php echo form_close(); ?>
Run Code Online (Sandbox Code Playgroud)

然后单击提交后将我重定向localhost到127.0.0.1

提交表格后,它将我重定向到

http://127.0.0.1/teradasys/index.php/user/login
Run Code Online (Sandbox Code Playgroud)

这是我的控制器

public function index() {

       if($this->aauth->is_loggedin()) {

       } else {
            $data['page_header'] = 'Login Form';
            $this->load->view('users/login', $data);
       }

    }

    public function login() {

        $identifier = $this->input->post('username');
        $password = $this->input->post('password');

        if ($this->aauth->login($identifier, $password, true)){
            return true;
        } else {
            $note = $this->aauth->get_errors_array();
            $this->session->set_flashdata('note', $note[0]);

            $data['page_header'] = 'Login Form';
            $this->load->view('users/login', $data);

        }

    }
Run Code Online (Sandbox Code Playgroud)

Yos*_*oka 5

请在application / config / config.php中检查您的基本URL

并更改它。

$config['base_url'] = 'http://localhost/test/';
Run Code Online (Sandbox Code Playgroud)