Я столкнулся с неработающей переадресацией в одном из моих методов. но остальное перенаправление работает. , кстати, в моем локальном хосте, что перенаправление работает, но когда я помещаю его на свой сайт, чтобы проверить его. он не перешел к этому перенаправлению, а остался в signup_validation и все еще получил подтверждение по электронной почте в моем письме.Переадресация Codeigniter не работает на сайте
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');
}
}
}
}
Я тоже пробовал это, когда я нажимаю кнопку регистрации, он будет запасать в base_url(). 'Main/signup_validation', и он не переходит к перенаправлению. а также когда im работает в localhost, что перенаправление работает. – erinr
@EdgarOng попробуйте 'echo'' uri', который вы передали и запустили скрипт после 'echo' в определении' redirect', выясните, напечатан ли 'url' то, что вы передали. –