1. URL组成部分
- scheme://host:port/path?key=value
- scheme:访问的协议
- host:主机名、域名
- port:端口号
- path:页面路径
- key=value:查询字符串
2. 解析URL
- 假设页面路径http://localhost/query?userId=123,在flask中使用request变量获取URL相关参数
- request.url = http://localhost/query?userId=123
- request.base_url = http://localhost/query
- request.host = localhost
- request.host_url = http://localhost/
- request.path = /query
- request.full.path = /query?userId=123