Post JSON to Codeigniter controller

后端 未结 12 1067
鱼传尺愫
鱼传尺愫 2020-12-30 05:03

I am trying to receive and parse a JSON object sent in a POST request using Codeigniter but I cannot \"find\" it.

This is my controller code:

public          


        
12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 05:14

    Try this code, it will output an array with all your parameters.

    $this->input->raw_input_stream;
    
    $input_data = json_decode($this->input->raw_input_stream, true);
    

    $input_data will return array

提交回复
热议问题