Live2D

15 变量的使用

1 To create and use a variable:----变量的创建和使用

  • Select the environment quick look icon Quick Look icon at the top right of Postman----在工具右侧顶部,点击快速查看环境变量眼睛图标

  • Next to Globals, select Edit.---在Globals下点击编辑

  • Add a variable named my_variable and give it an initial value of Hello.---添加一个变量名my_variable及给一个初始值hello

  • Select Save icon Save, then close the environment tab.---选择保存图标保存,然后关闭环境变量页签

  • Open a new request tab and enter https://postman-echo.com/get?var={{my_variable}} as the URL. Hover over the variable name to inspect the variable's value and scope.---打开一个新的请求页签 输入地址并替换变量引用 用{{变量名}}

  • Select Send and send the request. Inspect the response, which confirms that Postman sent the variable value to the API.---发送请求查看变量是否发送给API

  • INITIAL VALUE--分享给团队的如集合 全局值
  • CURRENT VALUE--用于发送请求的值,默认不会同步到postman服务器

2 Understanding variables===变量的理解
A variable is a symbolic representation of data that enables you to access a value without having to enter it manually wherever you need it. This can be useful if you are using the same values in multiple places. Variables make your requests more flexible and readable, by abstracting the detail away.

  • 一个变量是数据的符号表现,它能够使你在需要它的地方不用手动输入。如果你在多个地府使用同一个值。使得你的请求更灵活可读。
    (1)For example, if you have the same URL in more than one request, but the URL might change later, you can store the URL in a variable base_url and reference it in your requests using {{base_url}}. If the URL changes, you can change the variable value and it will be reflected throughout your collection, wherever you've used the variable name.
  • ----例如,如果你在多个请求中使用同一个地址,但是URL可能后期改变,你可以把URL保存在变量base_URL,然后在你的请求中引用它通过 {{base_url}},如果请求地址改变,你可以修改变量值。将会通过集合 及任何你用变量名的地方显示

posted @ 2022-07-02 21:38  soulor  阅读(34)  评论(0编辑  收藏  举报