Home > Backend Development > PHP Tutorial > What is the difference between post and get in php

What is the difference between post and get in php

一个新手
Release: 2023-03-16 17:02:01
Original
6665 people have browsed it

What is the difference between post and get in php

The difference between post and get in php

Here we have sorted out the differences between two kinds of get and post. .

First type:

GET is harmless when the browser rolls back, while POST will submit the request again.

The URL address generated by GET can be Bookmarked (marked), but POST cannot.

GET requests will be actively cached (stored) by the browser, while POST will not unless manually set.

GET requests can only be URL encoded, while POST supports multiple encoding methods.

GET request parameters will be completely retained in the browser history, while parameters in POST will not be retained.

There is a length limit on the parameters transmitted in the URL for the GET request, but there is no length limit for POST.

Regarding the data type of parameters, GET only accepts ASCII (American Standard Code for Information Interchange) characters, while POST has no restrictions.

GET is less secure than POST because the parameters are directly exposed on the URL, so it cannot be used to pass sensitive information.

GET parameters are passed through the URL, and POST is placed in the Request body.

The second type,

1, get is to obtain data from the server, and post is to transmit data to the server.

2. Get adds the parameter data queue to the URL pointed to by the ACTION attribute of the submitted form. The value corresponds to each field in the form and can be seen in the URL.

Post uses the HTTP post mechanism to place each field in the form and its content in the HTML HEADER and transmit it to the URL address pointed to by the ACTION attribute. Users cannot see this process.

3. The amount of data transmitted by get is small and cannot be larger than 2KB.

The amount of data transmitted by post is relatively large and is generally unrestricted by default.

4. The security of get is very low, but the security of post is high. But the execution efficiency is better than the Post method.

Note: Post is just a bit more secure than get. It does not mean that it is foolproof. In programming languages, security is the most important (in the output statements, echo, print, var_dump and other output statements must be To use filtering functions such as htmlentiti() or regular filtering);

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of What is the difference between post and get in php. 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