Codeigniter重定向在网站中不起作用


Codeigniter redirect not working in website

我在一个方法中遇到了无法进行重定向的情况。但是rest重定向正在起作用。顺便说一句,在我的localhost中,重定向是有效的,但当我把它放在我的网站上测试它时。它没有传递给重定向,而是停留在signup_validation中,并且仍然在我的电子邮件中收到电子邮件验证。

public function signup_validation() {
    $account = array(
        'email' => strip_tags($this->input->post('email')),
        'password' => sha1($this->input->post('password')),
        'firstname' => strip_tags($this->input->post('firstname')),
        'lastname' => strip_tags($this->input->post('lastname')),
        'contact_number' => $this->input->post('contact_number'),
        'home_address' => strip_tags($this->input->post('home_address')),
        'gender' => $this->input->post('gender'),
        'g-recaptcha-response' => $this->input->post('g-recaptcha-response')
    );
    $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[account.email]');
    $this->form_validation->set_rules('password', 'Password', 'required|min_length[6]|max_length[32]');
    $this->form_validation->set_rules('cpassword', 'Confirm Password', 'required|matches[password]');
    $this->form_validation->set_rules('firstname', 'First name', 'required|callback_alpha_dash_space');
    $this->form_validation->set_rules('lastname', 'Last name', 'required|callback_alpha_dash_space');
    $this->form_validation->set_rules('contact_number', 'Contact Number', 'required|callback_number|min_length[7]|max_length[11]');
    $this->form_validation->set_rules('gender', 'Gender', 'required');
    $this->form_validation->set_rules('home_address', 'required|callback_address');
    $this->form_validation->set_rules('tac', 'Terms and Condition', 'required');
    $this->form_validation->set_rules('g-recaptcha-response', 'Recaptcha', 'required');
    $this->form_validation->set_message('number', 'The %s must be a number');
    $this->form_validation->set_message('address','The %s must contain only letters, period, comma, spaces and dash.');
    $this->form_validation->set_message('is_unique', 'Email address is already used.');
    $this->form_validation->set_message('alpha_dash_space','The %s must contain only letters, period, spaces, and dash.');
    if ($this->form_validation->run() == FALSE) {
        $this->register();
    } else {
        $recaptcha = $this->input->post('g-recaptcha-response');
            if (!empty($recaptcha)) {
                $response = $this->recaptcha->verifyResponse($recaptcha);
                if (isset($response['success']) and $response['success'] === true) {
                   $this->MainModel->add_account();
                    redirect('main/email_sent', 'refresh');     
                }
            }
    }
}

删除redirect()的第二个参数,当将第二个设置为'refresh'时,此方法只会刷新当前页面。

redirect('main/email_sent');

从中删除第二个参数('refresh')

redirect('main/email_sent', 'refresh'); 

很高兴知道它是否有效。