post与get的区别

226 阅读1分钟

post与get的区别

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
       /*get与post区别 
       
       1.传参方式不同 
            get : 参数直接在url后面拼接 (请求行)
            post:参数在xhr.send()中发送(请求体)

       2.传参速度不同
            get : 速度快
            post : 速度慢

       3.数据大小不同
            get : 有大小限制。 不同浏览器大小不一样 。 一般2-5KB
            post : 无限制
                * 一般带文件的接口都是post

       4.安全性不同
            get : 安全性低
            post : 安全性高
                * 一般登录注册都是post
       */

      
    </script>
</body>
</html>
```