大家好我会问一些关于如何直接链接获取uri段的问题。在我的网络应用程序中,我会像这样获取uri段直接链接
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/
我真的需要帮助。谢谢:))
答案 0 :(得分:0)
您不应该使用base_url进行重定向
redirect('/controller/method/id');
或者您也可以尝试(如果在同一个控制器中)
$this->methodName($id);