发布表单时发布与放置 [英] post vs. put when posting a form

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

问题描述

在评估表单提交时,我检查该方法是发布的,没有得到。我被告知这是一种很好的方法,可以通过单击提交按钮来提交表单,并且它不仅仅是通过传递URL中的数据的脚本提交的。



put方法如何?这似乎与后非常相似。是否可以或多或少地用post来代替post而没有太大的损失?

解决方案

否。



HTML仅支持 post get 作为表单方法,即使HTTP有其他方式。 p>

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


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"?

解决方案

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".

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

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