Home > Article > Backend Development > What are the differences between php post and get
php The differences between post and get are: 1. GET is harmless when the browser rolls back, while POST will submit the request again; 2. The URL address generated by GET can be Bookmarked, but POST cannot ;3. GET requests will be actively cached by the browser, but POST will not unless manually set.
Recommended: "PHP Tutorial"
Here we sort out the differences between 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 one-to-one 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.
Post transmits a large amount of data 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 more secure than get, but it does not mean it is foolproof. In programming languages, security is the most important (in output statements, echo, print, var_dump and other output statements must be Use filtering functions such as htmlentiti() or regular filtering);
The above is the detailed content of What are the differences between php post and get. For more information, please follow other related articles on the PHP Chinese website!