繁体   English   中英

如何建立直接链接以获取uri细分

[英]How to make a direct link to get the uri segment

大家好,我会问一些有关如何直接链接到uri的问题。 在我的Web应用程序中,我将直接与get uri segment这样链接

http://localhost/ttaportal/ref_application/manage_access/18

我有一个控制器

function insert_access(){
    $id = $this->uri->segment(3);
    $refAppAccess  = $this->input->post('accessId');
    $refApplicationId  = $this->input->post('appId');
    $refDepartmentId  = $this->input->post('deptId');

    $data = array(
                "refApplicationId" => $refApplicationId,
                "refDepartmentId" => $refDepartmentId
            );
    $action = $this->ref_application_model->insert_access($data);           
    if($action == 1) {
        $this->session->set_flashdata('message', 'Application access has been added successfully');
    }
    else {
        $this->session->set_flashdata('message', 'Failed to add application access');
    }

    redirect(base_url() . 'ref_application/manage_access/'.$id, 'refresh');
}

我已经尝试过了,但总是重定向到

http://localhost/ttaportal/ref_application/

我真的需要帮助 谢谢 :)

您不应该使用base_url进行重定向

 redirect('/controller/method/id');

或者您也可以尝试一下(如果在同一控制器中)

$this->methodName($id);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM