Get the http headers from current request in PHP

后端 未结 6 1855
梦谈多话
梦谈多话 2020-12-08 04:10

Is it possible to get the http headers of the current request with PHP? I am not using Apache as the web-server, but using nginx.

I tried using

6条回答
  •  天命终不由人
    2020-12-08 04:56

    You can upgrade your server to PHP 5.4 thereby giving you access to getallheaders() via fastcgi or simply parse what you need out of $_SERVER with a foreach loop and a little regex.

提交回复
热议问题