GET与POST [英] GET vs POST

查看:85
本文介绍了GET与POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然不清楚METHOD = GET

和METHOD = POST之间的区别究竟是什么样的表格,即使在几本书上看了

网站。我很感激你能给我的任何澄清。


我想要传递Javascript约会的元素

单独(年,月,日,小时,分钟,秒)到CGI。如果我要以
将这些值存储在一个隐藏的表单中,并在某些时候提交该表单,那么

我希望该表单的方法是GET还是POST?


-

Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我

ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。

解决方案



" Christopher Benson-Manica" schreef ...

我仍然不清楚
METHOD = GET和METHOD = POST之间的区别是什么,即使在查看了几个表格之后在网上预订
。我很感激你能给我的任何澄清。

我想要分别传递Javascript
日期的元素(年,月) ,日期,小时,分钟,秒)到CGI。如果我是
以隐藏的形式存储这些值,并且在某些时候提交该表单,
我希望该表单的方法是GET还是POST?







这可能是一个很好的起点:

http://www.w3.org/TR/html4/interact/...#submit-format


一些实用的东西:


GET可以加入书签,而POST通常不会。

GET中的表单数据可以从历史记录中轻松恢复,因此无法用于密码等物品。


Fred


Christopher Benson-Manica写道:

我还不清楚
METHOD = GET和METHOD =之间究竟有什么区别即使在网上查看了几本书之后,POST也适用于表格。我很感激你能给我的任何澄清。


获取对URI的查询字符串部分中的数据进行编码,并且对于在服务器上不做任何更改的

查询。由于数据位于

URI中,因此它是可收藏的。


将数据作为单独的http标头进行后编码,并用于查询

在服务器上进行更改。 Post还允许发送更多数据。

我想要分别传递Javascript
日期的元素(年,月,日) ,小时,分钟,秒)到CGI。如果我要以隐藏的形式存储这些值,并在某些时候提交
表单,我是否希望该表单的方法是GET或POST?




这取决于你想用它做什么。


-

David Dorward http://dorward.me.uk/


主要区别对于我们作为开发人员而言,最重要的是所有东西的放置

。当您提交时发送一个表格。


假设你有一个< input type =" input"名称= QUOT;垃圾">在表单上。

提交表单时,< form ACTION =" URL">上指定的网址是

调用。

此URL将接收参数名称/值对junk =(

输入框的内容) ;


如果< form>指定GET的方法,<形式ACTION =" URL" METHOD =GET>,

URL将被称为

如下

" URL?junk =(内容输入框)


如果< form>指定POST方法,< form ACTION =" URL" METHOD =POST>,

将调用URL

如下

" URL"

注意,没有?junk =(输入框的内容)。文本字符串尾随

URL。


接收URL仍然可以访问junk =(输入内容

box)名称/值对,但它不显示在浏览器的URL位置

框。


名称/值对junk =(内容输入框)在HTTP标题中

(我认为)。在任何一种情况下,以下ASP代码都将检索

名称/值对...

请求(垃圾)


语句Request(junk)将在表单提交时返回字符串,即

内容的文本框


Christopher Benson-Manica <在*** @ nospam.cyberspace.org>在留言中写道

news:bo ********** @ chessie.cirr.com ...

我还不太清楚
METHOD = GET和METHOD = POST之间的区别究竟是什么,即使在网上查看了几本书中的
之后。我很感激你能给我的任何澄清。

我想要分别传递Javascript
日期的元素(年,月) ,日期,小时,分钟,秒)到CGI。如果我是
以隐藏的形式存储这些值,并且在某些时候提交该表单,
我希望该表单的方法是GET还是POST?

- -
Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我
ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。



I''m still quite unclear as to what exactly the difference between METHOD=GET
and METHOD=POST is for forms, even after looking in several books an on the
web. I''d appreciate any clarifications you could give me.

I''m in a situation where I''d like to pass the elements of a Javascript date
separately (year, month, date, hour, minute, second) to a CGI. If I were to
store these values in a hidden form and at some point submit that form, would
I want the method for that form to be GET or POST?

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.

解决方案


"Christopher Benson-Manica" schreef...

I''m still quite unclear as to what exactly the difference between METHOD=GET and METHOD=POST is for forms, even after looking in several books an on the web. I''d appreciate any clarifications you could give me.

I''m in a situation where I''d like to pass the elements of a Javascript date separately (year, month, date, hour, minute, second) to a CGI. If I were to store these values in a hidden form and at some point submit that form, would I want the method for that form to be GET or POST?



Hi,

This may be a good starting point:

http://www.w3.org/TR/html4/interact/...#submit-format

Some practical things:

A GET can be bookmarked, while a POST can usually not.
Form data from a GET is easely recovered from history, thus not usable for
things like passwords.

Fred


Christopher Benson-Manica wrote:

I''m still quite unclear as to what exactly the difference between
METHOD=GET and METHOD=POST is for forms, even after looking in several
books an on the web. I''d appreciate any clarifications you could give me.
Get encodes the data in the query string section of the URI and is for
queries which don''t make any change on the server. As the data is in the
URI, it is bookmarkable.

Post encodes the data as seperate http headers, and is for queries which do
make changes on the server. Post also allows much more data to be sent.
I''m in a situation where I''d like to pass the elements of a Javascript
date separately (year, month, date, hour, minute, second) to a CGI. If I
were to store these values in a hidden form and at some point submit that
form, would I want the method for that form to be GET or POST?



That depends what you want to do with it.

--
David Dorward http://dorward.me.uk/


The main difference that matters most, to us as developers, is the placing
of all the "stuff" sent along when you "submit" a form.

Suppose you have a <input type="input" name="junk"> on your form.
When the form is submitted, the URL specified on the <form ACTION="URL"> is
called.
This URL will receive a parameter name/value pair of "junk=(contents of the
input box)"

If the <form> specified a METHOD of GET, <form ACTION="URL" METHOD="GET">,
the URL will be called
as the following
"URL?junk=(contents of the input box)"

If the <form> specified a METHOD of POST, <form ACTION="URL" METHOD="POST">,
the URL will be called
as the following
"URL"
Note, there is no "?junk=(contents of input box)" text string trailing the
URL.

The receiving URL will still have access to the "junk=(contents of input
box)" name/value pair, but it does not show up in the browsers URL location
box.

The name/value pair of "junk=(contents of input box)" is in the HTTP headers
(I think). In either case the following ASP code will retreive the
name/value pair...
Request("junk")

The statement Request("junk") will return the string that is the contents of
the text box when the form was submit''ted

"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bo**********@chessie.cirr.com...

I''m still quite unclear as to what exactly the difference between METHOD=GET and METHOD=POST is for forms, even after looking in several books an on the web. I''d appreciate any clarifications you could give me.

I''m in a situation where I''d like to pass the elements of a Javascript date separately (year, month, date, hour, minute, second) to a CGI. If I were to store these values in a hidden form and at some point submit that form, would I want the method for that form to be GET or POST?

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.



这篇关于GET与POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆