在web2py中如何获取当前页面的完整URL?我想要浏览器地址栏中显示的(可能已重写的)网址.
例如 http://www.example.com/products/televisions?sort=price&page=2
Ant*_*ony 10
最简单的生成方法可能是:
URL(args=request.args, vars=request.get_vars, host=True)
Run Code Online (Sandbox Code Playgroud)
您也可以这样组装URL:
'%s://%s%s' % (request.env.wsgi_url_scheme, request.env.http_host,
request.env.web2py_original_uri)
Run Code Online (Sandbox Code Playgroud)