Home > Article > Backend Development > 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!