zoukankan      html  css  js  c++  java
  • get和post区别

    get方式访问和post方式访问

    get/post区别?

    http协议结构:

    请求报文包含:

    请求行 method path

    请求头

    Content-Type:application/json

    Content-Type:application/x-www-form-urlencoded

    cookies

    token

    xxx    //空行

    请求体 ... ...(字符串)

    1. 如果是get方式请求,请求体中无参数;如果想传参,可以通过查询字符串,参数拼接在url后面

    也可以header在传递(token jwt

    请求方式

    get

    参数格式

    查询字符串(的形式)

    get  url?key1=value&key2=value

    2. 如果是post方式请求,参数一般放在请求体

    请求方式

    post

    参数格式

    1) 查询字符串[表单数据]

    name=terry&age=12

    2) json

    {"name":"terry","age":"12"}

     

    1,get传递参数通过url传递,post参数是放在请求体中

    2,get回退无害,post回退会再次请求

    3,get产生的url地址可以被收藏,而post不会

    4,get请求参数会被完整保留在浏览历史记录里,而post中的参数不会被保留

    5,get 请求在url中传送的参数有长度限制,而post没有

    6,get请求只能进行url编码,而post支持多种编码方式(如json)

  • 相关阅读:
    Python requests“Max retries exceeded with url” error
    命令行链接mongo、redis、mysql
    python 删除字典某个key(键)及对应值
    python标准模块(二)
    python标准模块(一)
    格式化输出
    LeetCode----1. Two Sum
    文件操作(初阶)
    python函数基础
    python3内置函数
  • 原文地址:https://www.cnblogs.com/wskb/p/10955234.html
Copyright © 2011-2022 走看看