当前位置:网站首页>The difference between get and post

The difference between get and post

2022-07-07 23:59:00 Xiao Zhang, run quickly.

get and post The main differences are as follows :

Essential difference :GET It's from the server Get data ;POST Is to the server To transfer data

1、url visibility :

get, Parameters url so ;

post,url Parameters are not visible

2、 Data transmission :

get, By joining together url Pass parameters ;

post, adopt body Body transfer parameters

3、 Cacheability :

get Requests can be cached

post Requests cannot be cached

4、 Back page reaction

get When requesting page back , No impact

post When requesting page back , Will resubmit the request

5、 The size of the transmitted data

get Generally, the size of the transmitted data shall not exceed 2k-4k( Depending on the browser , Restrictions are different , But it's not much different )

post The size of the requested transfer data is based on php.ini Profile settings , It can be infinite .

6、 Security

This is also the most difficult to analyze , In principle, post It must be better than get Security , After all, when transmitting parameters url invisible , But it can't stop some people from grabbing bags and playing when they are free . The security individual feels is not much different , That's why we should guard against gentlemen and villains . Encrypt the passed parameters , It's all the same .

7、 Data packets

GET Produce a TCP Data packets ;POST Produce two TCP Data packets . about GET Method request , The browser will http header and data Send along , Server response 200( Return the data ); And for POST, Browser sends first header, Server response 100 continue, The browser sends data, Server response 200 ok( Return the data ). In a good network environment , The difference between the time to send a packet and the time to send two packets is negligible . And in the case of bad network environment , The two packages TCP On verifying packet integrity , It has great advantages . Not all browsers will be there POST Send two packets in ,Firefox Just send it once .
 

原网站

版权声明
本文为[Xiao Zhang, run quickly.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130553106105.html