Home > Backend Development > PHP Tutorial > Explain in detail the difference between get and post

Explain in detail the difference between get and post

韦小宝
Release: 2023-03-21 11:04:02
Original
1843 people have browsed it

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!

1. Request form

  • 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
Copy after login

2. The size of the transmitted data

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

3, Security

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

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

4. Type of transmitted data

  1. GET request: only ASCII characters allowed

  2. POST Request: Supports multiple data types

5. Impact on the server

  1. GET request: obtained from the server Data, also known as query, only obtains server resources and does not modify them.

  2. 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template