Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Ruby中获得与Python类似的表单数据';s cgi.fieldstorage()?_Ruby_Forms_Form Data_Http Post - Fatal编程技术网

如何在Ruby中获得与Python类似的表单数据';s cgi.fieldstorage()?

如何在Ruby中获得与Python类似的表单数据';s cgi.fieldstorage()?,ruby,forms,form-data,http-post,Ruby,Forms,Form Data,Http Post,为了帮助自己学习Ruby,我正在将一个简单的Python网站转换成Ruby。不过,我不知道如何在Ruby中获取表单值。我如何做到这一点?您看过任何流行的Ruby web框架吗?如果你有一个小的站点,Rails可能有点过头了,但是Sinatra很好而且很轻。这两个框架都通过paramshash来提供这些值。@Beerlington我最终将介绍框架,但我仍在学习Ruby,不想学习Rails之类的高级东西。 require "cgi" cgi = CGI.new params = cgi.params

为了帮助自己学习Ruby,我正在将一个简单的Python网站转换成Ruby。不过,我不知道如何在Ruby中获取表单值。我如何做到这一点?

您看过任何流行的Ruby web框架吗?如果你有一个小的站点,Rails可能有点过头了,但是Sinatra很好而且很轻。这两个框架都通过
params
hash来提供这些值。@Beerlington我最终将介绍框架,但我仍在学习Ruby,不想学习Rails之类的高级东西。
require "cgi"
cgi = CGI.new
params = cgi.params # a hash with field-names and their values