GET和POST的区别

来源:互联网 发布:电脑视频美颜软件 编辑:程序博客网 时间:2024/05/19 20:22

 GET is meant to be used for getting things. Period, you might use the parameters to help figure out what to send back, but the point is—you’re not making any changes on the server! POST is meant to be used for sending data to be processed. This could be as simple as query parameters used to figure out what to send back, just as with a GET, but when you think of POST, think: update. Think: use the data from the POST body to change something on the server

1.With GET, the parameter data is limited to what you can stuff into the Request line

2.When you use GET, the parameter data shows up in the browser’s input bar,they are visible。

3.GET requests can be bookmarked; POST requests cannot.

4.The HTTP 1.1 spec declares GET, HEAD, and PUT as idempotent,
even though you CAN write a non-idemtotent doGet() method yourself (but shouldn’t). POST is not considered idempotent by the HTTP 1.1 spec.


GET is the simplest HTTP method, and its main job in life is to ask the server to get a resource and send it back. That resource might be an HTML page, a JPEG, a PDF, etc. Doesn’t matter. The point of GET is to get something back from the server.
POST is a more powerful request. It’s like a GET plus plus. With POST, you can request something and at the same time send form data to the server (later in this chapter we’ll see what the server might do with that data).