CodeIgniter - 在请求中打印自定义值 header

CodeIgniter - print custom values in request header

如何使用 CodeIgniter 打印在接收到的请求的 header 中设置的值?

我尝试了 print_r($_SERVER);,但对我没有帮助。我希望有一种不同的方式使用 CI.

如果您从表单提交发送值,

$_REQUEST will help you

or

    $this->input->post();
    $this->input->get();

简单使用,

$this->input->request_headers();

从请求中接收所有值header

$valuesInHeader = $this->input->request_headers();

从请求中获取特定值header

$hostValueInHeader = $this->input->request_headers()['Host'];
//"Host" is a key of a value, you can use your required key.