Catching the url path following a python cgi script?

廉价感情. 提交于 2019-12-11 02:43:08

问题


It's better if I do an example to explain my question:

Filename of cgi script: 'awesome'
URL: http://omgpython.com/awesome
'awesome' script runs normally.

I append a 'fake' path: '/omg/so/fake'
URL: http://omgpython.com/awesome/omg/so/fake'

'awesome' script runs normally without any errors, but is it possible to catch the 'fake' path within 'awesome'?

I'm trying to clean the URL by not using URL params.


回答1:


You want os.environ['PATH_INFO']. In the second example it will contain "/omg/so/fake".



来源:https://stackoverflow.com/questions/4939067/catching-the-url-path-following-a-python-cgi-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!