获取当前请求的所有HTTP 请求头信息,如:
~~~
$headers = $request->header();
print_r($headers);
~~~
直接获取某个请求头信息,如:
~~~
$token = $request->header('XX-Token');
~~~
HTTP请求头信息的名称不区分大小写,并且下划线会自动转换为-,所以下面的写法都是等效的:
~~~
$token = $request->header('xx-token');
$token = $request->header('XX-Token');
$token = $request->header('xx_token');
~~~