• <i id='S1Rx7'><tr id='S1Rx7'><dt id='S1Rx7'><q id='S1Rx7'><span id='S1Rx7'><b id='S1Rx7'><form id='S1Rx7'><ins id='S1Rx7'></ins><ul id='S1Rx7'></ul><sub id='S1Rx7'></sub></form><legend id='S1Rx7'></legend><bdo id='S1Rx7'><pre id='S1Rx7'><center id='S1Rx7'></center></pre></bdo></b><th id='S1Rx7'></th></span></q></dt></tr></i><div id='S1Rx7'><tfoot id='S1Rx7'></tfoot><dl id='S1Rx7'><fieldset id='S1Rx7'></fieldset></dl></div>
      <bdo id='S1Rx7'></bdo><ul id='S1Rx7'></ul>
  • <tfoot id='S1Rx7'></tfoot>

      <small id='S1Rx7'></small><noframes id='S1Rx7'>

      <legend id='S1Rx7'><style id='S1Rx7'><dir id='S1Rx7'><q id='S1Rx7'></q></dir></style></legend>

      1. file_get_contents("php://input") 或 $HTTP_RAW_POST_

        file_get_contents(quot;php://inputquot;) or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?(file_get_contents(php://input) 或 $HTTP_RAW_POST_DATA,哪一个更适合获取 JSON 请求的正文?) - IT屋-程序员软件开发技术分享社
        <i id='CR3mO'><tr id='CR3mO'><dt id='CR3mO'><q id='CR3mO'><span id='CR3mO'><b id='CR3mO'><form id='CR3mO'><ins id='CR3mO'></ins><ul id='CR3mO'></ul><sub id='CR3mO'></sub></form><legend id='CR3mO'></legend><bdo id='CR3mO'><pre id='CR3mO'><center id='CR3mO'></center></pre></bdo></b><th id='CR3mO'></th></span></q></dt></tr></i><div id='CR3mO'><tfoot id='CR3mO'></tfoot><dl id='CR3mO'><fieldset id='CR3mO'></fieldset></dl></div>

          <legend id='CR3mO'><style id='CR3mO'><dir id='CR3mO'><q id='CR3mO'></q></dir></style></legend>
            <tbody id='CR3mO'></tbody>
        1. <tfoot id='CR3mO'></tfoot>
            • <small id='CR3mO'></small><noframes id='CR3mO'>

                <bdo id='CR3mO'></bdo><ul id='CR3mO'></ul>
                  本文介绍了file_get_contents("php://input") 或 $HTTP_RAW_POST_DATA,哪一个更适合获取 JSON 请求的正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  file_get_contents("php://input")$HTTP_RAW_POST_DATA - 哪一个更适合获取 JSON 请求的正文?

                  file_get_contents("php://input") or $HTTP_RAW_POST_DATA - which one is better to get the body of JSON request?

                  当使用客户端 XmlHTTPRequest 时,我应该使用哪种请求类型(GETPOST)来发送 JSON 数据?

                  And which request type (GET or POST) should I use to send JSON data when using client side XmlHTTPRequest?

                  我的问题是从这个答案中得到启发的:如何使用 curl 将 JSON 发布到 PHP

                  My question was inspired from this answer: How to post JSON to PHP with curl

                  引用该答案:

                  从协议的角度来看,file_get_contents("php://input") 实际上更正确,因为您实际上并没有真正处理 http 多部分表单数据.

                  From a protocol perspective file_get_contents("php://input") is actually more correct, since you're not really processing http multipart form data anyway.

                  推荐答案

                  其实php://input可以让你读取原始请求体.

                  Actually php://input allows you to read raw request body.

                  它是 $HTTP_RAW_POST_DATA 的内存密集型替代方案,不需要任何特殊的 php.ini 指令.来自 参考

                  php://input 不适用于 enctype=multipart/form-data".

                  这篇关于file_get_contents("php://input") 或 $HTTP_RAW_POST_DATA,哪一个更适合获取 JSON 请求的正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  When should use doctrine ORM and when zend-db-table?(什么时候应该使用学说 ORM,什么时候应该使用 zend-db-table?)
                  Doctrine - self-referencing entity - disable fetching of children(Doctrine - 自引用实体 - 禁用获取子项)
                  Doctrine 2, query inside entities(原则 2,实体内部查询)
                  Complex WHERE clauses using the PHP Doctrine ORM(使用 PHP Doctrine ORM 的复杂 WHERE 子句)
                  Doctrine - OneToMany relation, all result row doesn#39;t fetch in object(Doctrine - OneToMany 关系,所有结果行不获取对象)
                  Doctrine and unrefreshed relationships(教义和未更新的关系)

                    <tbody id='nvhir'></tbody>
                  <tfoot id='nvhir'></tfoot>

                    1. <i id='nvhir'><tr id='nvhir'><dt id='nvhir'><q id='nvhir'><span id='nvhir'><b id='nvhir'><form id='nvhir'><ins id='nvhir'></ins><ul id='nvhir'></ul><sub id='nvhir'></sub></form><legend id='nvhir'></legend><bdo id='nvhir'><pre id='nvhir'><center id='nvhir'></center></pre></bdo></b><th id='nvhir'></th></span></q></dt></tr></i><div id='nvhir'><tfoot id='nvhir'></tfoot><dl id='nvhir'><fieldset id='nvhir'></fieldset></dl></div>

                          <legend id='nvhir'><style id='nvhir'><dir id='nvhir'><q id='nvhir'></q></dir></style></legend>
                        • <small id='nvhir'></small><noframes id='nvhir'>

                          • <bdo id='nvhir'></bdo><ul id='nvhir'></ul>