Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Codeigniter 3中提交表单后,localhost正在重定向到127.0.0.1_Codeigniter - Fatal编程技术网

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

在Codeigniter 3中提交表单后,localhost正在重定向到127.0.0.1,codeigniter,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" />

我的代码有问题。我的代码中有一个表单如下所示:

<?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(); ?>
这是我的控制器

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);

        }

    }

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

并改变它

$config['base_url'] = 'http://localhost/test/';

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

并改变它

$config['base_url'] = 'http://localhost/test/';

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

$config['base_url'] = 'http://localhost/test/';


放置此文件后无需更改任何内容。如果您使用本地或实时主机。

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

$config['base_url'] = 'http://localhost/test/';


放置后无需更改任何内容。如果您使用本地或实时主机。

需要在codeigniter 3中的
config.php
中更改
base\u url
,最好设置您的基本url
$config['base\u url']='http://localhost/project/';
在旧版本中,您可以将其留空并提交表单,但在CI3中,如果不设置基本url,您可能会遇到问题。需要在codeigniter 3中的
config.php
中更改
base\u url
,设置基本url
$config['base\u url']='http://localhost/project/';在旧版本中,您可以将其保留为空并提交表单,但在CI3中,如果您不设置基本url,则可能会遇到问题。是的,它可以工作,谢谢,但我感到困惑,因为在我的其他项目中,我没有设置基本url,并且working@Jerielle不客气。如果您使用codeigniter,这一点很重要,请确保您不要忘记。好的,当我在一个实时主机中移动我的项目时,我也需要更改此项吗?@Yoshioka当您设置基本url时,在其末尾使用正斜杠
/
$config['base\u url']='http://localhost/test/';
@wolfgang1983噢,我忘记了最后一个斜杠,谢谢你的更正是的,它可以工作,谢谢,但我很困惑,因为在我的另一个项目中,我没有设置基本url,它是working@Jerielle不客气。如果您使用codeigniter,这一点很重要,请确保您不要忘记。好的,当我在一个实时主机中移动我的项目时,我也需要更改此项吗?@Yoshioka当您设置基本url时,在其末尾使用正斜杠
/
$config['base\u url']='http://localhost/test/';@wolfgang1983哦,我忘了最后一个斜杠,谢谢你的更正