我是新手web.py.我用了很多PHP.在PHP中,POST参数和GET参数存储在不同的全局变量中
例如:
curl http://127.0.0.1/test?get_param1=1 -d 'post_param1=2'
在PHP中,你可以获得$_GET['get_param1']1和$_POST['post_param1']2.
但似乎无法区分GET/POST参数web.py?
我只能用于web.input()在类似dict的对象中获取GET/POST参数,但我无法分辨哪些来自查询字符串,哪些来自POST数据
Ben*_*oyt 16
实际上,有一个(无证?)_method的参数,可以是get,post或者both(默认值),从不同的来源返回变量.请参阅web.input()的源代码.例如:
get_input = web.input(_method='get')
post_input = web.input(_method='post')
Run Code Online (Sandbox Code Playgroud)
但是,我经常使用web.py,从不需要这个.为什么需要区分查询字符串中的输入参数和数据?