2016-07-31 7 views
0

私の方法の1つでリダイレクトが動作していません。残りのリダイレクトは機能しています。 ところで、私のlocalhostではリダイレクトが動作していますが、テストするために私のサイトに入れています。それはそのリダイレクトに渡されず、代わりに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');  
       } 
      } 

    } 
} 

答えて

0

redirect()の2番目のパラメータを削除し、'refresh'に2つ目のパラメータを設定する場合、このメソッドは、単に現在のページを更新します。

redirect('main/email_sent'); 
+0

登録ボタンを押してもbase_url()。 'main/signup_validation'に保存されていて、リダイレクトに進むことはありません。また、リダイレクトが動作するlocalhostで作業しているときも同様です。 – erinr

+0

@EdgarOngあなたが渡した 'uri'を 'echo'しようとし、 'redirect'の定義で' echo 'の後にスクリプトを終了し、' url'が渡されたものであるかどうか調べてください。 –

0

それが動作するかどうかを知ることだけで興奮

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

から( 'リフレッシュ')二番目のパラメータを削除します。

+0

以前はまだ仕事をしていたと悲しんでいました。 – erinr

関連する問題