<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 背景:假如前端或者提供的接口必須以指定的格式傳輸 ## **json格式:會設置 content-type 為 application/json** ~~~ type TestController struct { ? beego.Controller ? } ? type Person struct { ? Id int ? Name string ? Gender string } ? func (g *TestController)Get() { ? test_data := Person{Id:123,Name:"zhiliao",Gender:"男"} ? g.Data["json"] = &test_data ? ? ? ? ? ? ? ? ? -----這里必須叫json,因為ServeJSON()解析json變量的 ? fmt.Println(test_data) ? g.ServeJSON() ? //g.TplName = "test.html" } ~~~ ## **xml格式:會設置 content-type 為 application/xml** ~~~ test_data := Person{Id:123,Name:"zhiliao",Gender:"男"} g.Data["xml"] = &test_data ? ? ? ? ? ? ? ? ? ? ? ? ? -----這里必須叫xml,同上 g.ServeXML() ~~~ ## **jsonp格式:會設置 content-type 為 application/javascript** ~~~ test_data := Person{Id:123,Name:"zhiliao",Gender:"男"} g.Data["jsonp"] = &test_data ? ? ? ? ? ? ? ? ? ? ? -----這里必須叫jsonp,同上 g.ServeJSONP() ~~~ ## **yaml格式:會以文件傳輸的方式,yaml就是鍵值對** ~~~ test_data := Person{Id:123,Name:"zhiliao",Gender:"男"} g.Data["yaml"] = &test_data g.ServeYAML() ~~~ yaml格式: ~~~ student: - name : "zhiliao" - age : 18 ? teacher: - name : "laowang" -age : 38 ? ? addr: "市區" ~~~ ~~~ 說明: ? 1.大小寫敏感 2.使用縮進表示層級關系 3.縮進不允許使用tab,只允許空格 4.縮進的空格數不重要,只要相同層級的元素左對齊即可 5.'#'表示注釋 6.以 - 開頭的行表示構成一個數組,支持多維數組 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看