通过控制器重定向时为什么会显示状态码303

时间:2018-09-27 08:43:16

标签: codeigniter redirect controller http-status-code-303

我需要确保代码没有错误,但是这里的状态代码显示为303,并显示“查看更多”。预览和响应还显示“无法加载响应数据”。

删除重定向行后,状态码显示为200。

下面是我的控制器功能。

public function sendmail()
{
    $config = array(
        // config data
    );

    $this->email->initialize($config);

    $senderEmail = $this->input->post('senderEmail');
    $senderName = $this->input->post('senderName');
    $content = $this->input->post('emailcont');


    if ($this->emailModel->sendmail($senderEmail, $senderName, $content)) {
        $this->session->set_flashdata("email_sent","Email sent successfully.");  
        redirect('AboutController');
    }
    else {
        $this->session->set_flashdata("email_sent","Error in sending Email.");
    }       
}

为什么会这样?

1 个答案:

答案 0 :(得分:1)

You should have to use the function name also .You have to provide 
AboutController's 
function name where you want to redirect .
Try :
redirect('AboutController/function_name');
But Please make sure that you are using atleast codeigniter version 3.0