选择POST和GET [英] Choosing between POST and GET
问题描述
可能存在重复:
GET与POST(表单处理)
我对POST和GET感兴趣。为什么我确实需要它们,它们之间有什么区别?我知道他们都从某个网址检索了一些数据,但这可能就是我所知道的。
I'm interested in POST and GET. Why do I exactly need them and what is the difference between them? I know they both retrieve some data from some url, but that's probably all I know.
推荐答案
GET纯粹用于检索。 GET的一个最重要的方面是GET永远不允许改变服务器的状态(意思是修改)。
GET is purely for retrieval. One of the most important aspects of GET is that GET is never allowed to change the state of the server (meaning: modifications).
POST允许这样做。
POST does allow that.
这个区别非常重要。所以如果你基于几个参数/过滤器等获取信息。 GET会做得很好,但只要你在服务器上修改任何东西,你必须使用POST。
This distinction is incredibly important. So if you're fetching info based on a couple of parameters/filters/etc. GET will do fine, but as soon as you're modifying anything on the server you MUST use POST.
这篇关于选择POST和GET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!