Home >Backend Development >PHP Tutorial >Explain in detail the difference between get and post
This article talks about the difference between get and post. For many students, the difference between the two is not very clear. So today we will talk about the difference between get and post. Which! Without further ado, let’s get straight to the point!
GET request: The requested data will be appended to the URL to split the URL and transmit data. Multiple parameters are connected with &. The URL encoding format uses ASCII encoding instead of uniclde, which means that all non-ASCII characters must be encoded before being transmitted.
POST request: The requested data will be placed in the body of the HTTP request package.
For example, name=shuaige below is the actual transmission data.
[plain] view plain copy POST /inventory-check.cgi HTTP/1.1 Host: www.joes-hardware.com Content-Type: text/plain Content-length: 18 item=shuaige 2647
GET request: In the HTTP specification, there is no definition of the length of the URL and the size of the transmitted data. limit. But in the actual development process, for GET, specific browsers and servers have restrictions on the length of the URL. Therefore, when using a GET request, the transmitted data will be limited by the length of the URL. Generally, the amount of data transmitted does not exceed 2KB
POST request: Since it is not a URLpass value, in theory, it will not be restricted, but in fact, each server will stipulate a limit on the size of POST submission data, and Apache and IIS have their own configurations.
GET request: The security of the transmitted parameters is low, because the transmitted data will be displayed The URL is visible to everyone and will be cached and retained in the browser history.
POST request: The data is stored in the request package for transmission and will not be displayed in the URL, and the parameters will not be cached and saved in the browser history or web server logs.
GET request: only ASCII characters allowed
POST Request: Supports multiple data types
GET request: obtained from the server Data, also known as query, only obtains server resources and does not modify them.
POST request: Submit data to the server, which involves update of the data, that is, changing the server's data.
Related recommendations:
##PHP uses CURL to implement GET and POST request step examples
The difference between get and post in php
The above is the detailed content of Explain in detail the difference between get and post. For more information, please follow other related articles on the PHP Chinese website!