发布表单时的 post 与 put

发布于 2024-09-30 15:51:32 字数 169 浏览 4 评论 0原文

当评估表单是否已提交时,我检查方法是否为 post,而不是 get。有人告诉我,这是一个好方法,可以了解表单是通过单击“提交”按钮提交的,而不仅仅是由在 url 中传递数据的脚本提交的。

“put”方法怎么样?看起来和“post”很相似。是否可以或多或少地用它来代替“邮寄”而不损失“邮寄”所提供的好处呢?

When evaluating that a form was submitted, I check that the method was post, not get. I was told this is a good way to know that the form was submitted by clicking the submit button and that it's not just being submitted by a script that's passing the data in the url.

How about the "put" method. It seems very similar to "post". Can it be more or less be used instead of "post" without much loss in the benefits provided by "post"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浅唱ヾ落雨殇 2024-10-07 15:51:32

不可以。

HTML 仅支持 post 和 < code>get 作为表单方法,尽管 HTTP 还有其他方法。

即使在 HTML 表单的上下文之外,答案仍然是否定的,因为 PUT 和 POST 非常不同。 POST 是一个通用的“这是一些数据,用它做一些事情”方法,而 PUT 的意思是“用这个数据替换这个 URI 上的资源”。

No.

HTML only supports post and get as form methods, even though HTTP has others.

Even outside the context of an HTML form, the answer is still no as PUT and POST are very different. POST is a generic "Here is some data, do something with it" method, while PUT means "Replace the resource at this URI with this data".

燕归巢 2024-10-07 15:51:32

如果您这样做是出于安全原因,则 GETPOST 并不重要。阅读有关 XSRF 预防的 Wikipedia 文章:http://en.wikipedia.org/wiki/Cross -site_request_forgery#预防

If you're doing it for security reasons, GET or POST doesn't matter. Read the Wikipedia article on XSRF prevention: http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention

往事随风而去 2024-10-07 15:51:32

put 和 post 在安全方面没有什么区别......
但某些服务不支持 put

there is no different between put and post in security ...
but put is not supported in some of service's

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文