Codeigniter:将整个 POST 请求发送到另一个控制器的方法

Hos*_*ebi 5 php parameters post codeigniter

我有一个通用控制器,它将获取POST请求并决定调用任何控制器的已知方法。控制器将根据要求选择。

此外,我需要将整个POST请求发送到所选方法而不进行篡改。


更说明
获取在post请求controller 1,处理该请求,并决定召开known_method()controller X | X != 1。还向该方法发送主要请求。例如

public function index()
{
    $post = $this->input->post();

    //handling the request and decide to call the following method of another controller

    Controller_X->known_method($post);
    //OR
    redirect("site_url/controller_X/known_method/{$post}");
}  
Run Code Online (Sandbox Code Playgroud)

但是因为$post作为参数发送,因为它会作为GET请求发送,可能会篡改它的数据,这不是实用的方法。session在目标方法中存储和检索它也不是一个好的解决方案。


问题:如何将这些数据发送到我选择的目标?

提前致谢

Dan*_*rom 3

那么你可以将控制器包含在控制器中

if(toIncludeController_a()){
      $this->load->library('../controllers/Controller_a');
      $this->controller_a->myFunction(); //<- this function can also get the post data using $this->input->post
}
Run Code Online (Sandbox Code Playgroud)

控制器_a:

public function myFunction(){
     $data = $this->input->post();
}
Run Code Online (Sandbox Code Playgroud)