php 什么是“有效载荷”?例如 XML 有效负载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11283514/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 00:10:53  来源:igfitidea点击:

What is a "Payload"? e.g XML Payload

phpxmlrestsoappayload

提问by gilzero

While browsing some web service docs, I came across the word "payload", "xml payload" ...

在浏览一些 Web 服务文档时,我遇到了“ payload”、“ xml payload”这个词……

enter image description here

在此处输入图片说明



enter image description here

在此处输入图片说明



enter image description here

在此处输入图片说明



From wikipedia: "*Payload in computing (sometimes referred to as the actual or body data) is the cargo of a data transmission. *"

来自维基百科:“*计算中的有效载荷(有时称为实际或身体数据)是数据传输的货物。*”

Does not make much sense here. Can anyone explain what payload / xml payload mean? Thanks.

这里没有多大意义。任何人都可以解释有效载荷 / xml 有效载荷的含义吗?谢谢。

回答by Has QUIT--Anony-Mousse

The "payload" is the actual contents, as opposed to the wrapper, which is the boilerplate XML around (meta-data, document type and such). As such, it is the variablepart of the reply.

“有效负载”是实际内容,而不是包装器,它是周围的样板 XML(元数据、文档类型等)。因此,它是回复的可变部分。

The wikipedia definition makes perfectsense to me, as the "non payload" XML in these examples is completely uninteresting. The XML outside is the wrapping, and the payload are the contents ("cargo").

维基百科的定义对我来说非常有意义,因为这些示例中的“非有效负载”XML 完全无趣。外面的 XML 是包装,有效载荷是内容(“货物”)。

Note that "escaped payload" indicates that the contents are actually some other format, which may be XML escaped. It could be binary data, often escaped as CDATA or Base64, for example. There couldbe a JPEG image there, for example (if it is correctly escaped). Or HTML, encoded with XML entities. Then the payload would for example be:

请注意,“转义的有效负载”表示内容实际上是某种其他格式,可能是 XML 转义。例如,它可以是二进制数据,通常转义为 CDATA 或 Base64。例如,那里可能有一个 JPEG 图像(如果它被正确转义)。或 HTML,用 XML 实体编码。例如,有效载荷将是:

<div>example</div>

Which is a simple example for XML-escaped-HTML payload, when there is no reason for the message XML parser to parse the (XML-like) payload.

这是 XML 转义 HTML 有效负载的一个简单示例,当消息 XML 解析器没有理由解析(类似 XML 的)有效负载时。