<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 返回 JSON In it’s simplest form, JSON data can be returned with a default 200 HTTP status code. > 在其最簡單的形式中,可以使用默認的200 HTTP狀態碼返回JSON數據。 ~~~php $data = array('name' => 'Bob', 'age' => 40); $payload = json_encode($data); $response->getBody()->write($payload); return $response ->withHeader('Content-Type', 'application/json'); ~~~ Figure 15: Returning JSON with a 200 HTTP status code. We can also return JSON data with a custom HTTP status code. > 我們還可以使用定制的HTTP狀態碼返回JSON數據。 ~~~php $data = array('name' => 'Rob', 'age' => 40); $payload = json_encode($data); $response->getBody()->write($payload); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); ~~~ Figure 16: Returning JSON with a 201 HTTP status code. **Reminder** The Response object is immutable. This method returns a*copy*of the Response object that has a new Content-Type header.**This method is destructive**, and it*replaces*the existing Content-Type header. > 提醒 > Response對象是不可變的。此方法返回具有新內容類型標頭的響應對象的*copy*。**這個方法是毀滅性的**,它`替換`了現有的內容類型頭。 ## Returning a Redirect返回一個重定向 You can redirect the HTTP client by using the`Location`header. > 您可以使用`Location`報頭重定向HTTP客戶端。 ~~~php return $response ->withHeader('Location', 'https://www.example.com') ->withStatus(302); ~~~ Figure 17: Returning a redirect to https://www.example.com
                  <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>

                              哎呀哎呀视频在线观看