为什么代码点火器raw_input_stream为null?

时间:2019-03-18 17:15:10

标签: codeigniter

我想知道raw_input_stream为什么返回null。这是我从UI5进行的ajax调用。

$.ajax({
                url: "/CI/controllername/functionname",
                type: "POST",
                data: JSON.stringify(oParameters),
                contentType: "application/json",
                success: function (data) {
                    MessageToast.show(data);
                },
                error: function (e) {
                    MessageToast.show(e.status);
                }
            });

这是我的控制人

class controllername extends CI_Controller
{
    public function functionname()
    {
        echo $this->input->raw_input_stream;
        if ($this->input->raw_input_stream == null) echo "null";
    }
}

当我运行此代码时,raw_input_stream为null。不知道为什么。我在chrome开发人员工具上检查了请求有效负载,然后发送了数据。这是请求有效负载。

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试使用以下内容:

parse_str(urldecode($this->input->raw_input_stream), $output);
$data = $output;

这可能会有所帮助。

相关问题