Php 如何处理通过PUT附加到文件顶部的额外标题?
我正在使用PHP开发一个API 我通过PUT请求接受一个XML文件 使用Postman开发我的应用程序时,我看到以下内容:Php 如何处理通过PUT附加到文件顶部的额外标题?,php,postman,Php,Postman,我正在使用PHP开发一个API 我通过PUT请求接受一个XML文件 使用Postman开发我的应用程序时,我看到以下内容: ------WebKitFormBoundary0ASxhcJEf0dqxS1P Content-Disposition: form-data; name=""; filename="books.xml" Content-Type: text/xml <?xml version="1.0"?> <catalog> <book id=
------WebKitFormBoundary0ASxhcJEf0dqxS1P
Content-Disposition: form-data; name=""; filename="books.xml"
Content-Type: text/xml
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
...
</catalog>
------WebKitFormBoundary0ASxhcJEf0dqxS1P--
----WebKitFormBoundary0ASxhcJEf0dqxS1P
内容配置:表单数据;name=“”;filename=“books.xml”
内容类型:text/xml
马修·甘巴德拉
XML开发人员指南
计算机
44.95
2000-10-01
深入了解如何创建应用程序
使用XML。
...
------WebKitFormBoundary0ASxhcJEf0dqxS1P--
我通过echo file\u get\u contents(“php://input)
我可以截取或清理这些看起来来自WebKit的额外数据吗?表单数据实际上只用于HTML表单,而不是API。您所做的就像一个
选择
raw
或binary
该请求是如何提出的?@DanielA.White与邮差我通过表单数据附加文件不要使用表单数据。您是在询问边界吗?@DanielA.White请详细说明。有什么更好的选择?为什么?这将是一个很好的答案。