HTTP请求信息的Head书包
发布时间:2015-09-22 20:03:56head书包中包含ip、host、url、client等与HTTP请求相关的重要信息,如下表:
变量名 | 值 |
accept | text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 |
accept-encoding | gzip,deflate,sdch |
accept-language | zh-CN,zh;q=0.8,en;q=0.6 |
client | view (view表示浏览器、mobile表示手机、bot表示搜索引擎的爬虫) |
connection | keep-alive |
content-length | -1 |
content-type | |
enc | |
host | hua (主机名) |
ip | 10.0.0.12 (访问者的IP地址) |
port | 80 (端口) |
protocol | HTTP/1.1 |
querystring | n1=1&n2=2 |
uri | /_samples/head.html (当前网页地址) |
uri1 | /_samples/head.html?n1=1&n2=2 |
url | /_samples/head.html?n1=1&n2=2 (当前网页完整的链接地址) |
user-agent | Mozilla/5.0 (Windows NT 5.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36 (客户端工具信息) |
在开发时用表达式@{head:变量名}直接取值使用,如当前访问者的IP地址:@{head:ip}
(信息及例子文件:_samples/head.html)