6http头信息

6http头信息
点击领取淘宝京东拼多多唯品会优惠券

可以使用Request对象的header方法获取当前请求的HTTP请求头信息,例如:

$info = Request::header();
echo $info['accept'];
echo $info['accept-encoding'];
echo $info['user-agent'];
复制

也可以直接获取某个请求头信息,例如:

$agent = Request::header('user-agent');
复制

HTTP请求头信息的名称不区分大小写,并且_会自动转换为-,所以下面的写法都是等效的:

$agent = Request::header('user-agent');
$agent = Request::header('USER_AGENT');
复制

上一篇:6请求类型

下一篇:6伪静态