Python web.py:如何获取POST参数和get参数?
我不熟悉Python web.py:如何获取POST参数和get参数?,python,web,web.py,Python,Web,Web.py,我不熟悉web.py。我经常使用PHP。在PHP中,POST参数和GET参数存储在不同的全局变量中 例如: get_input = web.input(_method='get') post_input = web.input(_method='post') curlhttp://127.0.0.1/test?get_param1=1 -d'后参数1=2' 在PHP中,您可以得到$\u get['get\u param1']是1,$\u POST['POST\u param1']是2 但是在w
web.py
。我经常使用PHP。在PHP中,POST参数和GET参数存储在不同的全局变量中
例如:
get_input = web.input(_method='get')
post_input = web.input(_method='post')
curlhttp://127.0.0.1/test?get_param1=1 -d'后参数1=2'
在PHP中,您可以得到$\u get['get\u param1']
是1,$\u POST['POST\u param1']
是2
但是在web.py
中似乎不可能区分GET/POST参数
我只能使用web.input()
在类似dict的对象中获取get/POST参数,但我无法分辨它们中的哪一个来自查询字符串,哪一个来自POST数据实际上有一个(未记录的?\u方法
参数,可以是get
,POST
或这两个参数(默认值)从不同的源返回变量。例如:
get_input = web.input(_method='get')
post_input = web.input(_method='post')
然而,我已经使用了很多web.py,从来都不需要它。为什么需要区分查询字符串中的输入参数和数据?只是想知道这是否有效?如果是,请分别将答案标记为接受或投票。