在html中获取并发布方法 [英] Get and post method in html
问题描述
这三条语句的含义是什么:
-
如果使用get方法,并且页面被刷新,如果该页面的响应始终与发布的查询相同,则使用GET示例数据库搜索
如果与处理表单相关联的服务具有副作用(例如,修改数据库或订阅服务),则该方法应该是POST。
我理解的第二个部分是:当使用相同关键字从数据库完成查询时会生成相同的结果。例如:如何找到IP地址将在网站上每次都会产生相同的结果,直到有新帖子包含此字符串(如何查找IP地址)。但是,为什么get使用我不知道。
这将有助于获得您找到这些准则的上下文,但:
如果有人重新载入由 POST
操作产生的页面,他们通常会得到一个确认对话框你想重发提交的数据吗?,这对于有副作用的操作(如在数据库中创建记录)是一个有用的警告。例如,您不希望用户盲目创建同一订单的多个副本。
如果某人重新加载了由 GET
操作,在没有任何进一步确认的情况下,还有其他的考虑。您可以直接链接到
GET
请求,但不是 POST
和 POST
数据不会存储在浏览器历史记录中(尽管可能存储在插件或表单填充程序等其他内容中)。 what is the meaning of these three statements:
If get method is used and if the page is refreshed it would not prompt before the request is submitted again.
If the response of the page is always same for the posted query then use GET example database searches
If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.
The second one I understand partially: That the same result is generated when query is done from database using same keywords. For ex: "How to find ip address" will generate same results every time in a website until there are new posts that contain this string (How to find ip address). But why get is used I don't know.
It would help to have the context where you found those guidelines, but:
If someone reloads a page which resulted from a POST
operation, they'll usually get a confirmation dialog like "Do you want to resend the submitted data?", which is a useful warning for operations which have side-effects, such as creating records in a database. You don't want people to blindly create multiple copies of the same order, for instance.
If someone reloads a page which resulted from a GET
operation, it will be refreshed without any further confirmation, on the assumption that there will be no potentially undesirable side-effects on the server.
There are also other considerations. You can create a direct link to a GET
request, but not a POST
, and POST
data won't be stored in the browser history (though may be stored in other things like plugins or form-fillers).
这篇关于在html中获取并发布方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!