2012-06-14 246 views
-1

我正在使用CodeIgniter构建我的网站的jquery移动版本。 但我有重定向问题。重定向不起作用

例如: 我在页面«listComment»和我要添加评论。 当我添加它,功能«添加评论»启动,并在此 函数我被重定向到«listComment»。 但我不知道为什么我在页面上:www.mysite.com/mycontroller/AddComment 而不是www.mysite.com/mycontroller/listComment。 我看不到我的评论,如果我刷新我有很多错误 ,因为我不在良好的页面上。

我真的希望有人可以帮助我,我不明白为什么重定向不 工作在我的iPhone上,它适用于我在我的电脑上尝试移动版本。

在这里,我使用的代码,但我不知道哪里是麻烦,因为代码工作在我的电脑上罚款:

<?php  function add_comment_unite() 
{ 
    $data['users_online'] = $this->get_users_online(); 
    $data['uniteName'] = $this->uniteName(); 
    $data['numberInvit'] = $this->numberInvit(); 
    $data['friends'] = $this->get_friends_unite(); 

    $this->form_validation->set_rules('texte_comment_unite','Commentaire','trim|required|xss_clean'); 

    if($this->form_validation->run()) 
    { 
     $texte_comment_unite = $this->input->post('texte_comment_unite'); 
     $id_space_unite = $this->input->post('id_news_u'); 
     $id_membre = $this->session->userdata('id_membre'); 
     $id_unite = $this->session->userdata('id_unite'); 

     $data = array(
      'texte_comment_unite'=>$this->input->post('texte_comment_unite'), 
      'id_space_unite'=>$this->input->post('id_news_u'), 
      'id_membre'=>$this->session->userdata('id_membre'), 
      'id_unite'=>$this->session->userdata('id_unite'), 
     ); 

     $this->unite_model->add_comment_unite_model($data); 

     redirect('unite/get_news_unite'); 
    } 
    else 
    { 
     $data['friends'] = $this->get_friends_unite(); 
     $data['users_online'] = $this->get_users_online(); 
     $data['uniteName'] = $this->uniteName(); 
     $data['numberInvit'] = $this->numberInvit(); 

     $layout_network['contenu'] = $this->load->view('espace_unite', $data, TRUE); 
     $this->load->view('layout_network',$layout_network); 
    } 
} ?> 

在我看来,当我提交表单,我调用这个函数。

谢谢

+0

显示一些代码可能帮助....帮助我们帮助你.. – Justin

回答

0

你试过这个吗?

redirect('unite/get_news_unite', 'refresh');